Skip to content

Commit 2c3f038

Browse files
committed
Conditional test response for CakePHP < 5.0.5
1 parent 693f67b commit 2c3f038

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

tests/TestCase/Rule/Model/AddAssociationMatchOptionsTypesRuleTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
namespace CakeDC\PHPStan\Test\TestCase\Rule\Model;
55

6+
use Cake\Core\Configure;
67
use CakeDC\PHPStan\Rule\Model\AddAssociationMatchOptionsTypesRule;
78
use PHPStan\Rules\Properties\PropertyReflectionFinder;
89
use PHPStan\Rules\Rule;
@@ -37,6 +38,10 @@ protected function getRule(): Rule
3738
*/
3839
public function testRule(): void
3940
{
41+
$messageThrough = 'Call to CakeDC\PHPStan\Test\TestCase\Rule\Model\Fake\FailingRuleItemsTable::belongsToMany with option "through" (Cake\ORM\Table|string|null) does not accept stdClass.';
42+
if (version_compare(Configure::version(), '5.0.5', '<')) {
43+
$messageThrough = 'Call to CakeDC\PHPStan\Test\TestCase\Rule\Model\Fake\FailingRuleItemsTable::belongsToMany with option "through" (Cake\ORM\Table|string) does not accept stdClass.';
44+
}
4045
// first argument: path to the example file that contains some errors that should be reported by MyRule
4146
// second argument: an array of expected errors,
4247
// each error consists of the asserted error message, and the asserted error file line
@@ -106,7 +111,7 @@ public function testRule(): void
106111
98,
107112
],
108113
[
109-
'Call to CakeDC\PHPStan\Test\TestCase\Rule\Model\Fake\FailingRuleItemsTable::belongsToMany with option "through" (Cake\ORM\Table|string|null) does not accept stdClass.',
114+
$messageThrough,
110115
98,
111116
],
112117
[

tests/TestCase/Rule/Model/OrmSelectQueryFindMatchOptionsTypesRuleTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
namespace CakeDC\PHPStan\Test\TestCase\Rule\Model;
55

6+
use Cake\Core\Configure;
67
use CakeDC\PHPStan\Rule\Model\OrmSelectQueryFindMatchOptionsTypesRule;
78
use PHPStan\Rules\Rule;
89
use PHPStan\Rules\RuleLevelHelper;

0 commit comments

Comments
 (0)