Skip to content

Commit 2ba2294

Browse files
committed
update to cakephp 4.4
1 parent f921056 commit 2ba2294

File tree

11 files changed

+173
-46
lines changed

11 files changed

+173
-46
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"firebase/php-jwt": "^5.0"
3636
},
3737
"require-dev": {
38-
"cakephp/cakephp-codesniffer": "^4.0",
38+
"cakephp/cakephp-codesniffer": "~4.4.0",
3939
"league/flysystem-vfs": "^1.0",
4040
"phpunit/phpunit": "^9.5",
4141
"vlucas/phpdotenv": "^3.3"

phpunit.xml.dist

Lines changed: 22 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,24 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit
3-
colors="true"
4-
processIsolation="false"
5-
stopOnFailure="false"
6-
bootstrap="./tests/bootstrap.php"
7-
>
8-
<php>
9-
<ini name="memory_limit" value="-1"/>
10-
<ini name="apc.enable_cli" value="1"/>
11-
<env name="FIXTURE_SCHEMA_METADATA" value="./tests/schema.php"/>
12-
</php>
13-
14-
<!-- Add any additional test suites you want to run here -->
15-
<testsuites>
16-
<testsuite name="Api Test Suite">
17-
<directory>./tests/TestCase</directory>
18-
</testsuite>
19-
</testsuites>
20-
21-
<!-- Setup a listener for fixtures -->
22-
<extensions>
23-
<extension class="\Cake\TestSuite\Fixture\PHPUnitExtension" />
24-
</extensions>
25-
26-
<!-- Prevent coverage reports from looking in tests and vendors -->
27-
<filter>
28-
<whitelist processUncoveredFilesFromWhitelist="true">
29-
<directory suffix=".php">./src</directory>
30-
</whitelist>
31-
</filter>
32-
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" processIsolation="false" stopOnFailure="false" bootstrap="./tests/bootstrap.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3+
<coverage processUncoveredFiles="true">
4+
<include>
5+
<directory suffix=".php">./src</directory>
6+
</include>
7+
</coverage>
8+
<php>
9+
<ini name="memory_limit" value="-1"/>
10+
<ini name="apc.enable_cli" value="1"/>
11+
<env name="FIXTURE_SCHEMA_METADATA" value="./tests/schema.php"/>
12+
</php>
13+
<!-- Add any additional test suites you want to run here -->
14+
<testsuites>
15+
<testsuite name="Api Test Suite">
16+
<directory>./tests/TestCase</directory>
17+
</testsuite>
18+
</testsuites>
19+
<!-- Setup a listener for fixtures -->
20+
<extensions>
21+
<extension class="\Cake\TestSuite\Fixture\PHPUnitExtension"/>
22+
</extensions>
23+
<!-- Prevent coverage reports from looking in tests and vendors -->
3324
</phpunit>

src/Service/Action/Auth/LoginAction.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ protected function _authConfig(): array
124124
'username' => $this->_identifiedField,
125125
'password' => $this->_passwordField,
126126
],
127+
'finder' => 'active',
127128
],
128129
],
129130
]);

src/Service/Locator/ServiceLocator.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ public function get(string $alias, array $options = []): Service
174174
$options['className'] = Inflector::camelize(Inflector::underscore($className));
175175
$options['service'] = Inflector::dasherize($alias);
176176
} else {
177-
$options['className'] = $className;
178177
$options['className'] = $className;
179178
$options['service'] = Inflector::underscore($alias);
180179
}

tests/Base/BaseTraitTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ trait BaseTraitTest
2222
/**
2323
* Sets up the session as a logged in user for an user with id $id
2424
*
25-
* @param $id
25+
* @param mixed $id
2626
* @return void
2727
*/
2828
protected function loginAsUserId($id)

tests/TestCase/Auth/Authorize/SimpleRbacAuthorizeTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,10 @@ protected function preparePermissions($permissions)
156156

157157
/**
158158
* @dataProvider providerAuthorize
159-
* @param $permissions
160-
* @param $user
161-
* @param $requestParams
162-
* @param $expected
159+
* @param mixed $permissions
160+
* @param mixed $user
161+
* @param mixed $requestParams
162+
* @param mixed $expected
163163
* @param string|null $msg
164164
*/
165165
public function testAuthorize($permissions, $user, $requestParams, $expected, $msg = null)

tests/TestCase/Integration/Service/Action/Auth/LoginActionTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public function testSuccessLogin()
6363
'last_name' => 'last1',
6464
'active' => true,
6565
'api_token' => 'yyy',
66+
'role' => 'admin',
6667
];
6768
$data = Hash::get($result, 'data');
6869
unset($data['activation_date']);

tests/TestCase/Integration/Service/Action/Auth/RegisterActionTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ public function testSuccessRegister()
7878
'active' => false,
7979
'api_token' => null,
8080
'message' => 'Please validate your account before log in',
81+
'role' => 'user',
8182
];
8283
$data = $result['data'];
8384
unset($data['id'], $data['tos_date']);

tests/TestCase/Integration/Service/Action/Extension/CursorPaginationExtensionTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,6 @@ public function testListWithSinceIdWithNewDataAdded()
160160
$this->assertEquals('http://example.com/api/articles?max_id=16', Hash::get($result, 'pagination.links.next'));
161161
}
162162

163-
/**
164-
* @param $count
165-
*/
166163
protected function _addData($count)
167164
{
168165
$Article = TableRegistry::get('Articles');

tests/bootstrap.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
*/
1313

1414
use Cake\Core\Configure;
15+
use Cake\Error\ErrorTrap;
16+
use Cake\Error\ExceptionTrap;
1517
use Cake\Mailer\Email;
1618
use Cake\Utility\Security;
1719

@@ -156,11 +158,8 @@ class_alias(\CakeDC\Api\Test\App\Controller\AppController::class, 'App\Controlle
156158

157159
$isCli = PHP_SAPI === 'cli';
158160
$conf = (array)Cake\Core\Configure::read('Error');
159-
if ($isCli) {
160-
(new Cake\Error\ConsoleErrorHandler($conf))->register();
161-
} else {
162-
(new Cake\Error\ErrorHandler($conf))->register();
163-
}
161+
(new ErrorTrap($conf))->register();
162+
(new ExceptionTrap($conf))->register();
164163
\Cake\Routing\Router::reload();
165164
$application = new \CakeDC\Api\Test\App\Application(CONFIG);
166165
$application->bootstrap();

0 commit comments

Comments
 (0)