Skip to content

Commit bd73748

Browse files
authored
Merge pull request #19 from Divergence/develop
Version 2.0 - PHP 8.0 Support
2 parents 695ec79 + 45be53c commit bd73748

84 files changed

Lines changed: 1438 additions & 929 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
.php_cs.cache
2+
.php-cs-fixer.cache
23
vendor
34
.debug
45
.dev
56
build/*
67
phpDocumentor.phar
78
docs
89
.vscode
9-
composer.lock
10+
composer.lock
11+
.phpunit.result.cache

.php_cs.dist renamed to .php_cs.dist.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
file that was distributed with this source code.
1010
EOF;
1111

12-
$finder = PhpCsFixer\Finder::create()
12+
$finder = (new PhpCsFixer\Finder())
1313
//->exclude('somedir')
1414
->in(__DIR__)
1515
;
1616

17-
return PhpCsFixer\Config::create()
17+
return (new PhpCsFixer\Config())
1818
->setRules([
1919
'@PSR1' => true,
2020
'@PSR2' => true,

.scrutinizer.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
checks:
2+
php:
3+
code_rating: true
4+
duplication: true
5+
6+
build:
7+
image: default-bionic
8+
environment:
9+
php: 8.1.12
10+
variables:
11+
XDEBUG_MODE: 'coverage'
12+
nodes:
13+
coverage:
14+
services:
15+
mariadb:
16+
image: docker.io/library/mariadb:10.6.12
17+
env:
18+
MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: yes
19+
ports:
20+
- 3306
21+
ramdisks:
22+
- /var/run/mysqld
23+
dependencies:
24+
before:
25+
- mysql -u root -e "CREATE DATABASE IF NOT EXISTS test CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
26+
tests:
27+
override:
28+
- command: ./vendor/bin/phpunit --coverage-clover=build/coverage/clover.xml # Or "./vendor/bin/phpunit --coverage-clover=build/coverage/clover.xml"
29+
idle_timeout: 300
30+
coverage:
31+
file: 'build/coverage/clover.xml'
32+
format: 'php-clover'
33+
analysis:
34+
tests:
35+
override:
36+
- php-scrutinizer-run

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language: php
22
php:
3-
- '7.4'
3+
- '8.1'
44

55
services:
66
- mysql

composer.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,15 @@
1010
"email": "henry.paradiz@gmail.com",
1111
"homepage": "https://henryparadiz.com",
1212
"role": "Developer"
13+
},
14+
{
15+
"name": "Jack Smith",
16+
"email": "jgs41495@gmail.com",
17+
"role": "Developer"
1318
}
1419
],
1520
"require": {
16-
"php": ">=7.4",
21+
"php": ">=8.1",
1722
"twig/twig": "*",
1823
"filp/whoops": "*",
1924
"symfony/var-dumper": "^4.0",
@@ -34,10 +39,11 @@
3439
}
3540
},
3641
"require-dev": {
37-
"phpunit/phpunit": "^7.0",
42+
"phpunit/phpunit": "^9.5",
3843
"friendsofphp/php-cs-fixer": "*",
3944
"mikey179/vfsstream": "^1.6",
40-
"fzaninotto/faker": "^1.9"
45+
"fakerphp/faker": "^1.20",
46+
"dms/phpunit-arraysubset-asserts": "^0.4.0"
4147
},
4248
"suggest": {
4349
"divergence/cli": "Lets you initialize a new project as well as create, edit, and test database configurations via CLI."

config/app.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* For the full copyright and license information, please view the LICENSE
88
* file that was distributed with this source code.
99
*/
10-
use \Divergence\App as App;
10+
use Divergence\App as App;
1111

1212
return [
1313
'debug' => file_exists(App::$App->ApplicationPath . '/.debug'),

config/db.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,17 @@
3939
*
4040
*/
4141
'tests-mysql' => [
42-
'host' => 'localhost',
42+
'host' => '127.0.0.1',
4343
'database' => 'test',
44-
'username' => 'travis',
44+
'username' => 'root',
4545
'password' => '',
4646
],
4747
'tests-mysql-socket' => [
4848
// the first is for travis ci and default-ish linux, the second is for my dev machine using osx.
4949
// feel free to adjust for yourself but do not commit your preference
5050
'socket' => file_exists('/var/run/mysqld/mysqld.sock') ? '/var/run/mysqld/mysqld.sock' : '/tmp/mysql.sock',
5151
'database' => 'test',
52-
'username' => 'travis',
52+
'username' => 'root',
5353
'password' => '',
5454
],
5555
];

phpunit.xml

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,25 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
verbose="true"
4-
colors="true"
5-
bootstrap="vendor/autoload.php">
6-
<testsuites>
7-
<testsuite name="all">
8-
<directory>tests/Divergence</directory>
9-
</testsuite>
10-
</testsuites>
11-
<listeners>
12-
<listener class="Divergence\Tests\TestListener" file="./tests/Divergence/TestListener.php"></listener>
13-
</listeners>
14-
<filter>
15-
<whitelist>
16-
<directory>./src</directory>
17-
<exclude>
18-
<directory>./src/App</directory>
19-
<directory>./public</directory>
20-
<directory>./vendor</directory>
21-
<directory>./tests</directory>
22-
</exclude>
23-
</whitelist>
24-
</filter>
25-
<php>
26-
<const name="PHPUNIT_TESTSUITE" value="true"/>
27-
</php>
28-
</phpunit>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" verbose="true" colors="true" bootstrap="vendor/autoload.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3+
<coverage>
4+
<include>
5+
<directory>./src</directory>
6+
</include>
7+
<exclude>
8+
<directory>./src/App</directory>
9+
<directory>./public</directory>
10+
<directory>./vendor</directory>
11+
<directory>./tests</directory>
12+
</exclude>
13+
</coverage>
14+
<testsuites>
15+
<testsuite name="all">
16+
<directory>tests/Divergence</directory>
17+
</testsuite>
18+
</testsuites>
19+
<listeners>
20+
<listener class="Divergence\Tests\TestListener" file="./tests/Divergence/TestListener.php"/>
21+
</listeners>
22+
<php>
23+
<const name="PHPUNIT_TESTSUITE" value="true"/>
24+
</php>
25+
</phpunit>

readme.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![Build Status](https://travis-ci.org/Divergence/framework.svg?branch=release)](https://travis-ci.org/Divergence/framework) [![Coverage Status](https://coveralls.io/repos/github/Divergence/framework/badge.svg?branch=release)](https://coveralls.io/github/Divergence/framework?branch=release) [![codecov](https://codecov.io/gh/Divergence/framework/branch/release/graph/badge.svg)](https://codecov.io/gh/Divergence/framework) [![Latest Stable Version](https://poser.pugx.org/divergence/divergence/downloads)](https://packagist.org/packages/divergence/divergence) [![Latest Unstable Version](https://poser.pugx.org/divergence/divergence/v/stable)](https://packagist.org/packages/divergence/divergence) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/Divergence/framework/badges/quality-score.png?b=release)](https://scrutinizer-ci.com/g/Divergence/framework/?branch=release) [![License](https://poser.pugx.org/divergence/divergence/license)](https://packagist.org/packages/divergence/divergence)
1+
[![Code Coverage](https://scrutinizer-ci.com/g/Divergence/framework/badges/coverage.png?b=develop)](https://scrutinizer-ci.com/g/Divergence/framework/?branch=develop) [![Latest Stable Version](https://poser.pugx.org/divergence/divergence/downloads)](https://packagist.org/packages/divergence/divergence) [![Build Status](https://scrutinizer-ci.com/g/Divergence/framework/badges/build.png?b=develop)](https://scrutinizer-ci.com/g/Divergence/framework/build-status/develop) [![Latest Unstable Version](https://poser.pugx.org/divergence/divergence/v/stable)](https://packagist.org/packages/divergence/divergence) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/Divergence/framework/badges/quality-score.png?b=develop)](https://scrutinizer-ci.com/g/Divergence/framework/?branch=release) [![License](https://poser.pugx.org/divergence/divergence/license)](https://packagist.org/packages/divergence/divergence)
22

33
---
44
Divergence is a PHP framework designed for rapid development and modern practices without becoming an over abstracted mess.
@@ -16,22 +16,19 @@ Unit testing the code base and providing code coverage is a primary goal of this
1616
# Main Features
1717
* Models
1818
* Real PHP classes.
19-
* Extend an `ActiveRecord` class.
20-
* Use `traits` to unlock Relationships and Versioning as needed.
21-
* Automatically creates table on first time use.
19+
* Map fields with array or attributes.
20+
* Built in support for relationships and object versioning.
21+
* Speed up prototyping and automate new deployments by automatically creates table based on your models when none are found.
2222
* Built in support for MySQL.
2323

24-
* Database
25-
* Use the existing DB class or access PDO directly by calling `DB::getConnection()`.
26-
2724
* Routing
2825
* Simpler, faster, tree based routing system.
2926
* Built with basic class inheritance in mind.
3027

3128
* Controllers
3229
* Psr7 compatible controllers.
3330
* Pre-made REST API controllers allow you to build APIs rapidly.
34-
* 100% Unit test coverage for filters, sorters, and conditions go ive you peace of mind.
31+
* 100% Unit test coverage for filters, sorters, and conditions.
3532
* Build HTTP APIs in minutes by extending `RecordsRequestHandler` and setting the one config variable: the name of your model class.
3633
* Use a pre-made security trait with RecordsRequestHandler or extend it and write in your own permissions.
3734
* Standard permissions interface allows reuse of permission traits from one model to another.

src/App.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* For the full copyright and license information, please view the LICENSE
88
* file that was distributed with this source code.
99
*/
10+
1011
namespace Divergence;
1112

1213
use Divergence\Routing\Path;
@@ -17,7 +18,7 @@
1718

1819
class App
1920
{
20-
const VERSION = '1.1';
21+
public const VERSION = '1.1';
2122
public $ApplicationPath;
2223
public $Config;
2324
public Path $Path;
@@ -34,7 +35,9 @@ public function init($Path)
3435
{
3536
$this->ApplicationPath = $Path;
3637

37-
$this->Path = new Path($_SERVER['REQUEST_URI']);
38+
if (php_sapi_name()!=='cli') {
39+
$this->Path = new Path($_SERVER['REQUEST_URI']);
40+
}
3841

3942
$this->Config = $this->config('app');
4043

@@ -61,7 +64,7 @@ public function registerErrorHandler()
6164
{
6265
// only show errors in dev environment
6366
if ($this->Config['environment'] == 'dev') {
64-
$this->whoops = new \Whoops\Run;
67+
$this->whoops = new \Whoops\Run();
6568

6669
$Handler = new \Whoops\Handler\PrettyPageHandler();
6770
$Handler->setPageTitle("Divergence Error");

0 commit comments

Comments
 (0)