Skip to content

Commit c2e539c

Browse files
authored
Merge pull request #139 from FriendsOfCake/5.x-update
Bump up to CakePHP 5 stable.
2 parents 0cf63fa + cfec296 commit c2e539c

File tree

7 files changed

+27
-27
lines changed

7 files changed

+27
-27
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ phpstan-baseline.neon export-ignore
1818
phpunit.xml.dist export-ignore
1919
psalm.xml export-ignore
2020
psalm-baseline.xml export-ignore
21+
.phive export-ignore

.phive/phars.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phive xmlns="https://phar.io/phive">
3+
<phar name="phpstan" version="1.10.38" installed="1.10.38" location="./tools/phpstan" copy="false"/>
4+
<phar name="psalm" version="5.15.0" installed="5.15.0" location="./tools/psalm" copy="false"/>
5+
</phive>

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,12 @@ scope in your app's `routes.php`.
191191
```php
192192
// PostsController.php
193193

194-
// Override the viewClasses method of your controller:
195-
public function viewClasses()
194+
// Add the CsvView class for content type negotiation
195+
public function initialize(): void
196196
{
197-
return ['csv' => 'CsvView.Csv'];
197+
parent::initialize();
198+
199+
$this->addViewClasses(['csv' => 'CsvView.Csv']);
198200
}
199201

200202
// Controller action

composer.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,10 @@
4444
}
4545
],
4646
"require": {
47-
"php": ">=8.1",
48-
"cakephp/cakephp": "5.x-dev"
47+
"cakephp/cakephp": "^5.0"
4948
},
5049
"require-dev": {
51-
"phpunit/phpunit": "^9.5.0",
50+
"phpunit/phpunit": "^10.1",
5251
"cakephp/cakephp-codesniffer": "^5.0"
5352
},
5453
"autoload": {
@@ -85,7 +84,5 @@
8584
"allow-plugins": {
8685
"dealerdirect/phpcodesniffer-composer-installer": true
8786
}
88-
},
89-
"minimum-stability": "dev",
90-
"prefer-stable": true
87+
}
9188
}

phpunit.xml.dist

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,19 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit bootstrap="tests/bootstrap.php" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3-
4-
<!-- Add any additional test suites you want to run here -->
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="tests/bootstrap.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.4/phpunit.xsd">
53
<testsuites>
64
<testsuite name="csv-view">
7-
<directory>tests/TestCase/</directory>
5+
<directory>tests/TestCase/</directory>
86
</testsuite>
97
</testsuites>
10-
11-
<!-- Setup a listener for fixtures -->
128
<extensions>
13-
<extension class="\Cake\TestSuite\Fixture\PHPUnitExtension"/>
9+
<bootstrap class="Cake\TestSuite\Fixture\Extension\PHPUnitExtension"/>
1410
</extensions>
15-
16-
<coverage>
17-
<include>
18-
<directory suffix=".php">src/</directory>
19-
</include>
20-
</coverage>
21-
2211
<php>
2312
<env name="FIXTURE_SCHEMA_METADATA" value="./tests/schema.php"/>
2413
</php>
14+
<source>
15+
<include>
16+
<directory suffix=".php">src/</directory>
17+
</include>
18+
</source>
2519
</phpunit>

tests/TestCase/View/CsvViewTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ public function testPassingQueryAsData()
441441
$output = $this->view->render();
442442

443443
$articles->belongsTo('Authors');
444-
$query = $articles->find('all', ['contain' => 'Authors']);
444+
$query = $articles->find('all', contain: 'Authors');
445445
$_extract = ['title', 'body', 'author.name'];
446446
$this->view->set(['data' => $query])
447447
->setConfig(['extract' => $_extract, 'serialize' => 'data']);

tests/bootstrap.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
declare(strict_types=1);
33

44
use Cake\Core\Configure;
5+
use Cake\TestSuite\Fixture\SchemaLoader;
56

67
/**
78
* Test suite bootstrap
@@ -43,7 +44,7 @@
4344
],
4445
]);
4546

46-
if (env('FIXTURE_SCHEMA_METADATA')) {
47-
$loader = new Cake\TestSuite\Fixture\SchemaLoader();
48-
$loader->loadInternalFile(env('FIXTURE_SCHEMA_METADATA'));
47+
if (getenv('FIXTURE_SCHEMA_METADATA')) {
48+
$loader = new SchemaLoader();
49+
$loader->loadInternalFile(getenv('FIXTURE_SCHEMA_METADATA'));
4950
}

0 commit comments

Comments
 (0)