Skip to content

Commit dd05564

Browse files
authored
[3.x] Update PHPUnit to 10 (#130)
* update deprecations * update phpunit/phpcs
1 parent ecf9bc5 commit dd05564

File tree

5 files changed

+24
-16
lines changed

5 files changed

+24
-16
lines changed

Tests/AbstractWebApplicationTest.php

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ protected function tearDown(): void
6565
*
6666
* @return \Generator
6767
*/
68-
public function getDetectRequestUriData(): \Generator
68+
public static function getDetectRequestUriData(): \Generator
6969
{
7070
// HTTPS, PHP_SELF, REQUEST_URI, HTTP_HOST, SCRIPT_NAME, QUERY_STRING, (resulting uri)
7171
yield 'HTTP connection with path in PHP_SELF and query string set in REQUEST_URI' => [
@@ -114,7 +114,7 @@ public function getDetectRequestUriData(): \Generator
114114
*
115115
* @return \Generator
116116
*/
117-
public function getRedirectData(): \Generator
117+
public static function getRedirectData(): \Generator
118118
{
119119
// Note: url, (expected result)
120120
yield 'with_leading_slash' => ['/foo', 'http://' . self::TEST_HTTP_HOST . '/foo'];
@@ -201,7 +201,7 @@ public function testGetDeprecatedInputReadAccess()
201201
$object = $this->getMockForAbstractClass(AbstractWebApplication::class);
202202

203203
// Validate default objects unique to the web application are created
204-
$this->assertInstanceOf(Input::class, $object->input);
204+
$this->assertInstanceOf(Input::class, $object->getInput());
205205
}
206206

207207
/**
@@ -339,7 +339,7 @@ public function testCompressWithGzipEncoding()
339339

340340
$object = $this->getMockBuilder(AbstractWebApplication::class)
341341
->setConstructorArgs([null, null, $mockClient])
342-
->setMethods(['checkHeadersSent'])
342+
->onlyMethods(['checkHeadersSent'])
343343
->getMockForAbstractClass();
344344

345345
$object->expects($this->once())
@@ -409,7 +409,7 @@ public function testCompressWithDeflateEncoding()
409409

410410
$object = $this->getMockBuilder(AbstractWebApplication::class)
411411
->setConstructorArgs([null, null, $mockClient])
412-
->setMethods(['checkHeadersSent'])
412+
->onlyMethods(['checkHeadersSent'])
413413
->getMockForAbstractClass();
414414

415415
$object->expects($this->once())
@@ -473,7 +473,7 @@ public function testCompressWithNoAcceptEncodings()
473473

474474
$object = $this->getMockBuilder(AbstractWebApplication::class)
475475
->setConstructorArgs([null, null, $mockClient])
476-
->setMethods(['checkHeadersSent'])
476+
->onlyMethods(['checkHeadersSent'])
477477
->getMockForAbstractClass();
478478

479479
// Mock a response.
@@ -531,7 +531,14 @@ public function testCompressWithHeadersSent()
531531
['deflate', 'gzip']
532532
);
533533

534-
$object = $this->getMockForAbstractClass(AbstractWebApplication::class, [null, null, $mockClient]);
534+
$object = $this->getMockBuilder(AbstractWebApplication::class)
535+
->setConstructorArgs([null, null, $mockClient])
536+
->onlyMethods(['checkHeadersSent'])
537+
->getMockForAbstractClass();
538+
539+
$object->expects($this->once())
540+
->method('checkHeadersSent')
541+
->willReturn(true);
535542

536543
// Mock a response.
537544
$response = new TextResponse(
@@ -738,7 +745,7 @@ public function testRedirectLegacyBehavior()
738745
$date = new \DateTime('now', new \DateTimeZone('GMT'));
739746
$object->modifiedDate = $date;
740747

741-
$object->redirect($url, false);
748+
$object->redirect($url, 303);
742749

743750
$this->assertSame(
744751
self::$headers,
@@ -1161,7 +1168,7 @@ public function testRedirectWithMoved()
11611168
$date = new \DateTime('now', new \DateTimeZone('GMT'));
11621169
$object->modifiedDate = $date;
11631170

1164-
$object->redirect($url, true);
1171+
$object->redirect($url, 301);
11651172

11661173
$this->assertSame(
11671174
self::$headers,

Tests/Stubs/Controller.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
45
* @license GNU General Public License version 2 or later; see LICENSE

Tests/Stubs/HasArgumentsController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
45
* @license GNU General Public License version 2 or later; see LICENSE

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@
5252
"joomla/session": "^3.0",
5353
"joomla/test": "^3.0",
5454
"joomla/uri": "^3.0",
55-
"phpunit/phpunit": "^9.5.28",
56-
"symfony/phpunit-bridge": "^5.0",
57-
"squizlabs/php_codesniffer": "~3.7.1",
58-
"rector/rector": "^0.15.21",
55+
"phpunit/phpunit": "^10.0",
56+
"symfony/phpunit-bridge": "^7.0",
57+
"squizlabs/php_codesniffer": "~3.10.2",
58+
"rector/rector": "^1.0",
5959
"phpstan/phpstan": "^1.10.7",
6060
"phan/phan": "^5.4"
6161
},

phpunit.xml.dist

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/8.5/phpunit.xsd"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
44
bootstrap="vendor/autoload.php"
5-
cacheResultFile=".phpunit.cache/test-results"
6-
verbose="true">
5+
cacheDirectory=".phpunit.cache">
76
<testsuites>
87
<testsuite name="default">
98
<directory>Tests</directory>

0 commit comments

Comments
 (0)