Skip to content

Commit

Permalink
Merge pull request #295 from LordSimal/cake5
Browse files Browse the repository at this point in the history
allow PHPUnit 11
  • Loading branch information
dereuromark authored Sep 4, 2024
2 parents d1f1f0d + e56048e commit fce0cde
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 45 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
},
"require": {
"php": ">=8.1",
"cakephp/cakephp": "^5.0.3",
"cakephp/cakephp": "dev-5.next as 5.1.0",
"dereuromark/cakephp-shim": "^3.0.0"
},
"require-dev": {
"fig-r/psr2r-sniffer": "dev-master",
"mobiledetect/mobiledetectlib": "^3.74",
"phpunit/phpunit": "^10.1",
"phpunit/phpunit": "^10.5.5 || ^11.1.3",
"yangqi/htmldom": "^1.0"
},
"suggest": {
Expand Down
6 changes: 4 additions & 2 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ parameters:
level: 6
paths:
- src/
checkMissingIterableValueType: false
checkGenericClassInNonGenericObjectType: false
treatPhpDocTypesAsCertain: false
bootstrapFiles:
- %rootDir%/../../../tests/bootstrap.php
Expand All @@ -12,6 +10,10 @@ parameters:
- %rootDir%/../../../src/Utility/Mime
reportUnmatchedIgnoredErrors: false
ignoreErrors:
-
identifier: missingType.generics
-
identifier: missingType.iterableValue
-
message: '#Undefined variable: .+#'
path: '%rootDir%/../../../src/View/Helper/TreeHelper.php'
Expand Down
5 changes: 3 additions & 2 deletions tests/TestCase/Command/InflectCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

use Cake\Console\TestSuite\ConsoleIntegrationTestTrait;
use Cake\TestSuite\TestCase;
use Tools\Command\InflectCommand;

/**
* Tools\Command\InflectCommand Test Case
*
* @uses \Tools\Command\InflectCommand
*/
#[\PHPUnit\Framework\Attributes\UsesClass(InflectCommand::class)]
class InflectCommandTest extends TestCase {

use ConsoleIntegrationTestTrait;
Expand All @@ -22,6 +22,7 @@ class InflectCommandTest extends TestCase {
*/
public function setUp(): void {
parent::setUp();
$this->loadPlugins(['Tools']);
//$this->useCommandRunner();
}

Expand Down
5 changes: 2 additions & 3 deletions tests/TestCase/Controller/Admin/IconsControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
use Cake\Core\Configure;
use Cake\TestSuite\IntegrationTestTrait;
use Shim\TestSuite\TestCase;
use Tools\Controller\Admin\IconsController;
use Tools\View\Icon\BootstrapIcon;

/**
* @uses \Tools\Controller\Admin\IconsController
*/
#[\PHPUnit\Framework\Attributes\UsesClass(IconsController::class)]
class IconsControllerTest extends TestCase {

use IntegrationTestTrait;
Expand Down
5 changes: 2 additions & 3 deletions tests/TestCase/Controller/Admin/ToolsControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@

use Cake\TestSuite\IntegrationTestTrait;
use Shim\TestSuite\TestCase;
use Tools\Controller\Admin\ToolsController;

/**
* @uses \Tools\Controller\Admin\ToolsController
*/
#[\PHPUnit\Framework\Attributes\UsesClass(ToolsController::class)]
class ToolsControllerTest extends TestCase {

use IntegrationTestTrait;
Expand Down
6 changes: 3 additions & 3 deletions tests/TestCase/Controller/ShuntRequestControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
use Cake\TestSuite\IntegrationTestTrait;
use RuntimeException;
use Shim\TestSuite\TestCase;
use Tools\Controller\ShuntRequestController;

/**
* @uses \Tools\Controller\ShuntRequestController
*/
#[\PHPUnit\Framework\Attributes\UsesClass(ShuntRequestController::class)]
class ShuntRequestControllerTest extends TestCase {

use IntegrationTestTrait;
Expand All @@ -27,6 +26,7 @@ class ShuntRequestControllerTest extends TestCase {
public function setUp(): void {
parent::setUp();

$this->loadPlugins(['Tools']);
Configure::write('Config.allowedLanguages', []);
Configure::write('Config.defaultLanguage', null);
}
Expand Down
5 changes: 1 addition & 4 deletions tests/TestCase/Utility/ClockTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@
use Shim\TestSuite\TestCase;
use Tools\Utility\Clock;

/**
* @coversDefaultClass \Tools\Utility\Clock
*/
#[\PHPUnit\Framework\Attributes\CoversClass(Clock::class)]
class ClockTest extends TestCase {

/**
* @covers ::returnElapsedTime
* @return void
*/
public function testTime() {
Expand Down
26 changes: 1 addition & 25 deletions tests/TestCase/Utility/UtilityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
use Shim\TestSuite\TestCase;
use Tools\Utility\Utility;

/**
* @coversDefaultClass \Tools\Utility\Utility
*/
#[\PHPUnit\Framework\Attributes\CoversClass(Utility::class)]
class UtilityTest extends TestCase {

/**
Expand Down Expand Up @@ -43,7 +41,6 @@ public function testNotBlank() {
}

/**
* @covers ::inArray
* @return void
*/
public function testInArray() {
Expand Down Expand Up @@ -87,7 +84,6 @@ public function testTokenize() {
}

/**
* @covers ::pregMatch
* @return void
*/
public function testPregMatch() {
Expand Down Expand Up @@ -121,7 +117,6 @@ public function testPregMatch() {
}

/**
* @covers ::pregMatch
* @return void
*/
public function testPregMatchWithPatternEscape() {
Expand All @@ -141,7 +136,6 @@ public function testPregMatchWithPatternEscape() {
}

/**
* @covers ::pregMatchAll
* @return void
*/
public function testPregMatchAll() {
Expand All @@ -163,7 +157,6 @@ public function testPregMatchAll() {
}

/**
* @covers ::strSplit
* @return void
*/
public function testStrSplit() {
Expand All @@ -176,7 +169,6 @@ public function testStrSplit() {
}

/**
* @covers ::typeCast
* @return void
*/
public function testTypeCast() {
Expand All @@ -186,7 +178,6 @@ public function testTypeCast() {
}

/**
* @covers ::getClientIp
* @return void
*/
public function testGetClientIp() {
Expand All @@ -195,7 +186,6 @@ public function testGetClientIp() {
}

/**
* @covers ::fileExists
* @return void
*/
public function testFileExists() {
Expand All @@ -213,7 +203,6 @@ public function testFileExists() {
}

/**
* @covers ::urlExists
* @return void
*/
public function testUrlExists() {
Expand All @@ -225,7 +214,6 @@ public function testUrlExists() {
}

/**
* @covers ::getReferer
* @return void
*/
public function testGetReferer() {
Expand All @@ -245,7 +233,6 @@ public function testGetReferer() {
}

/**
* @covers ::getHeaderFromUrl
* @return void
*/
public function testGetHeaderFromUrl() {
Expand All @@ -255,7 +242,6 @@ public function testGetHeaderFromUrl() {
}

/**
* @covers ::autoPrefixUrl
* @return void
*/
public function testAutoPrefixUrl() {
Expand All @@ -264,7 +250,6 @@ public function testAutoPrefixUrl() {
}

/**
* @covers ::autoPrefixUrl
* @return void
*/
public function testAutoPrefixUrlWithDetection() {
Expand All @@ -273,7 +258,6 @@ public function testAutoPrefixUrlWithDetection() {
}

/**
* @covers ::cleanUrl
* @return void
*/
public function testCleanUrl() {
Expand Down Expand Up @@ -311,7 +295,6 @@ public function testStripUrl() {
}

/**
* @covers ::trimDeep
* @return void
*/
public function testDeep() {
Expand Down Expand Up @@ -343,7 +326,6 @@ public function testDeep() {
}

/**
* @covers ::trimDeep
* @return void
*/
public function testDeepTransformNullToString() {
Expand Down Expand Up @@ -545,7 +527,6 @@ public function testFlatten() {
}

/**
* @covers ::arrayFlatten
* @return void
*/
public function testArrayFlattenBasic() {
Expand All @@ -570,7 +551,6 @@ public function testArrayFlattenBasic() {
/**
* Test that deeper nested values overwrite higher ones.
*
* @covers ::arrayFlatten
* @return void
*/
public function testArrayFlatten() {
Expand All @@ -591,7 +571,6 @@ public function testArrayFlatten() {
}

/**
* @covers ::arrayFlatten
* @return void
*/
public function testArrayFlattenAndPreserveKeys() {
Expand All @@ -611,7 +590,6 @@ public function testArrayFlattenAndPreserveKeys() {
}

/**
* @covers ::arrayShiftKeys
* @return void
*/
public function testArrayShiftKeys() {
Expand All @@ -632,7 +610,6 @@ public function testArrayShiftKeys() {
}

/**
* @covers ::logicalAnd
* @return void
*/
public function testLogicalAnd() {
Expand All @@ -656,7 +633,6 @@ public function testLogicalAnd() {
}

/**
* @covers ::logicalOr
* @return void
*/
public function testLogicalOr() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ class FontAwesome4CollectorTest extends TestCase {
/**
* Show that we are still API compatible/valid.
*
* @dataProvider extensions
*
* @param string $extension
*
* @return void
*/
#[\PHPUnit\Framework\Attributes\DataProvider('extensions')]
public function testCollect(string $extension): void {
$path = TEST_FILES . 'font_icon' . DS . 'fa4' . DS . 'variables.' . $extension;

Expand Down

0 comments on commit fce0cde

Please sign in to comment.