diff --git a/.gitattributes b/.gitattributes index c5678cd..9eeb392 100644 --- a/.gitattributes +++ b/.gitattributes @@ -18,3 +18,4 @@ phpstan-baseline.neon export-ignore phpunit.xml.dist export-ignore psalm.xml export-ignore psalm-baseline.xml export-ignore +.phive export-ignore diff --git a/.phive/phars.xml b/.phive/phars.xml new file mode 100644 index 0000000..d2fe06f --- /dev/null +++ b/.phive/phars.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/README.md b/README.md index 19e51dc..caa0f5e 100644 --- a/README.md +++ b/README.md @@ -191,10 +191,12 @@ scope in your app's `routes.php`. ```php // PostsController.php -// Override the viewClasses method of your controller: -public function viewClasses() +// Add the CsvView class for content type negotiation +public function initialize(): void { - return ['csv' => 'CsvView.Csv']; + parent::initialize(); + + $this->addViewClasses(['csv' => 'CsvView.Csv']); } // Controller action diff --git a/composer.json b/composer.json index 8660501..c0bbb6a 100644 --- a/composer.json +++ b/composer.json @@ -44,11 +44,10 @@ } ], "require": { - "php": ">=8.1", - "cakephp/cakephp": "5.x-dev" + "cakephp/cakephp": "^5.0" }, "require-dev": { - "phpunit/phpunit": "^9.5.0", + "phpunit/phpunit": "^10.1", "cakephp/cakephp-codesniffer": "^5.0" }, "autoload": { @@ -85,7 +84,5 @@ "allow-plugins": { "dealerdirect/phpcodesniffer-composer-installer": true } - }, - "minimum-stability": "dev", - "prefer-stable": true + } } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 027d1d4..b3a3168 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,25 +1,19 @@ - - - + - tests/TestCase/ + tests/TestCase/ - - - + - - - - src/ - - - + + + src/ + + diff --git a/tests/TestCase/View/CsvViewTest.php b/tests/TestCase/View/CsvViewTest.php index 7da9a68..4dad49b 100644 --- a/tests/TestCase/View/CsvViewTest.php +++ b/tests/TestCase/View/CsvViewTest.php @@ -441,7 +441,7 @@ public function testPassingQueryAsData() $output = $this->view->render(); $articles->belongsTo('Authors'); - $query = $articles->find('all', ['contain' => 'Authors']); + $query = $articles->find('all', contain: 'Authors'); $_extract = ['title', 'body', 'author.name']; $this->view->set(['data' => $query]) ->setConfig(['extract' => $_extract, 'serialize' => 'data']); diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 17be3de..168d2bf 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -2,6 +2,7 @@ declare(strict_types=1); use Cake\Core\Configure; +use Cake\TestSuite\Fixture\SchemaLoader; /** * Test suite bootstrap @@ -43,7 +44,7 @@ ], ]); -if (env('FIXTURE_SCHEMA_METADATA')) { - $loader = new Cake\TestSuite\Fixture\SchemaLoader(); - $loader->loadInternalFile(env('FIXTURE_SCHEMA_METADATA')); +if (getenv('FIXTURE_SCHEMA_METADATA')) { + $loader = new SchemaLoader(); + $loader->loadInternalFile(getenv('FIXTURE_SCHEMA_METADATA')); }