forked from LM-Commons/LmcCors
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request LM-Commons#45 from visto9259/1.4.x
Upgraded to Phpunit 11 for PHP >=8.2
- Loading branch information
Showing
9 changed files
with
32 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
<?xml version="1.0"?> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
bootstrap="./tests/Bootstrap.php" colors="true" | ||
convertErrorsToExceptions="true" convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" verbose="true" stopOnFailure="false" | ||
processIsolation="false" backupGlobals="false" | ||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"> | ||
<coverage includeUncoveredFiles="true"> | ||
<include> | ||
<directory suffix=".php">./src</directory> | ||
</include> | ||
</coverage> | ||
bootstrap="./tests/Bootstrap.php" | ||
colors="true" | ||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" | ||
cacheDirectory=".phpunit.cache"> | ||
<testsuite name="LmcCors tests"> | ||
<directory>./tests</directory> | ||
</testsuite> | ||
<source> | ||
<include> | ||
<directory>./src</directory> | ||
</include> | ||
</source> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
namespace LmcCorsTest\Factory; | ||
|
||
use LmcCors\Options\CorsOptions; | ||
use PHPUnit\Framework\Attributes\CoversClass; | ||
use PHPUnit\Framework\TestCase; | ||
use LmcCorsTest\Util\ServiceManagerFactory; | ||
use Psr\Container\ContainerExceptionInterface; | ||
|
@@ -29,9 +30,9 @@ | |
* | ||
* @author Michaël Gallego <[email protected]> | ||
* | ||
* @covers \LmcCors\Factory\CorsOptionsFactory | ||
* @group Coverage | ||
*/ | ||
#[CoversClass('\LmcCors\Factory\CorsOptionsFactory')] | ||
class CorsOptionsFactoryTest extends TestCase | ||
{ | ||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
namespace LmcCorsTest\Factory; | ||
|
||
use LmcCors\Mvc\CorsRequestListener; | ||
use PHPUnit\Framework\Attributes\CoversClass; | ||
use PHPUnit\Framework\TestCase; | ||
use LmcCorsTest\Util\ServiceManagerFactory; | ||
|
||
|
@@ -27,9 +28,9 @@ | |
* | ||
* @author Michaël Gallego <[email protected]> | ||
* | ||
* @covers \LmcCors\Factory\CorsRequestListenerFactory | ||
* @group Coverage | ||
*/ | ||
#[CoversClass('\LmcCors\Factory\CorsRequestListenerFactory')] | ||
class CorsRequestListenerFactoryTest extends TestCase | ||
{ | ||
public function testCanCreateCorsRequestListener() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
namespace LmcCorsTest\Factory; | ||
|
||
use LmcCors\Service\CorsService; | ||
use PHPUnit\Framework\Attributes\CoversClass; | ||
use PHPUnit\Framework\TestCase as TestCase; | ||
use LmcCorsTest\Util\ServiceManagerFactory; | ||
|
||
|
@@ -27,9 +28,9 @@ | |
* | ||
* @author Michaël Gallego <[email protected]> | ||
* | ||
* @covers \LmcCors\Factory\CorsServiceFactory | ||
* @group Coverage | ||
*/ | ||
#[CoversClass('\LmcCors\Factory\CorsServiceFactory')] | ||
class CorsServiceFactoryTest extends TestCase | ||
{ | ||
public function testCanCreateCorsService() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ | |
|
||
namespace LmcCorsTest\Mvc; | ||
|
||
use PHPUnit\Framework\Attributes\CoversClass; | ||
use PHPUnit\Framework\TestCase; | ||
use Laminas\EventManager\EventManager; | ||
use Laminas\Http\Request as HttpRequest; | ||
|
@@ -34,9 +35,9 @@ | |
* | ||
* @author Michaël Gallego <[email protected]> | ||
* | ||
* @covers \LmcCors\Mvc\CorsRequestListener | ||
* @group Coverage | ||
*/ | ||
#[CoversClass('\LmcCors\Mvc\CorsRequestListener')] | ||
class CorsRequestListenerTest extends TestCase | ||
{ | ||
|
||
|
@@ -67,13 +68,14 @@ public function testAttach() | |
$eventManager = $this->getMockBuilder('Laminas\EventManager\EventManagerInterface')->getMock(); | ||
|
||
$matcher = $this->exactly(2); | ||
|
||
$eventManager | ||
->expects($matcher) | ||
->method('attach') | ||
->willReturnCallback(function (string $event, callable $callback, int $priority) use ($matcher) { | ||
match ($matcher->getInvocationCount()) { | ||
1 => $this->assertEquals(MvcEvent::EVENT_ROUTE, $event), | ||
2 => $this->assertEquals(MvcEvent::EVENT_FINISH, $event), | ||
match ($event) { | ||
MvcEvent::EVENT_ROUTE => '', | ||
MvcEvent::EVENT_FINISH => '', | ||
}; | ||
}); | ||
$this->corsListener->attach($eventManager); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ | |
|
||
namespace LmcCorsTest\Options; | ||
|
||
use PHPUnit\Framework\Attributes\CoversClass; | ||
use PHPUnit\Framework\TestCase; | ||
use LmcCors\Options\CorsOptions; | ||
|
||
|
@@ -26,9 +27,9 @@ | |
* | ||
* @author Michaël Gallego <[email protected]> | ||
* | ||
* @covers \LmcCors\Options\CorsOptions | ||
* @group Coverage | ||
*/ | ||
#[CoversClass('\LmcCors\Options\CorsOptions')] | ||
class CorsOptionsTest extends TestCase | ||
{ | ||
public function testCorsOptionsAreSecuredByDefault() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ | |
|
||
use LmcCors\Exception\DisallowedOriginException; | ||
use LmcCors\Exception\InvalidOriginException; | ||
use PHPUnit\Framework\Attributes\CoversClass; | ||
use PHPUnit\Framework\TestCase; | ||
use Laminas\Http\Response as HttpResponse; | ||
use Laminas\Http\Request as HttpRequest; | ||
|
@@ -33,9 +34,9 @@ | |
* | ||
* @author Florent Blaison <[email protected]> | ||
* | ||
* @covers \LmcCors\Service\CorsService | ||
* @group Coverage | ||
*/ | ||
#[CoversClass('\LmcCors\Service\CorsService')] | ||
class CorsServiceTest extends TestCase | ||
{ | ||
/** | ||
|