Skip to content

Commit e13a1e3

Browse files
Merge pull request #86 from eimkua1/php-8-support
PHP 8.0 support
2 parents b23d60e + 148829c commit e13a1e3

13 files changed

+1184
-550
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
/coveralls-upload.json
44
/phpunit.xml
55
/vendor/
6+
/.phpunit.result.cache
7+
/.phpcs-cache

composer.json

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@
2626
}
2727
},
2828
"require": {
29-
"php": "^7.3",
30-
"laminas-api-tools/api-tools-api-problem": "^1.2.1",
31-
"laminas-api-tools/api-tools-content-negotiation": "^1.2.2",
32-
"laminas-api-tools/api-tools-content-validation": "^1.3.3",
29+
"php": "^7.3 || ~8.0.0",
30+
"laminas-api-tools/api-tools-api-problem": "^1.4",
31+
"laminas-api-tools/api-tools-content-negotiation": "^1.5",
32+
"laminas-api-tools/api-tools-content-validation": "^1.9",
3333
"laminas-api-tools/api-tools-hal": "^1.4.1",
34-
"laminas-api-tools/api-tools-mvc-auth": "^1.4.1",
35-
"laminas-api-tools/api-tools-oauth2": "^1.4",
36-
"laminas-api-tools/api-tools-provider": "^1.2",
37-
"laminas-api-tools/api-tools-rest": "^1.3.1",
38-
"laminas-api-tools/api-tools-rpc": "^1.3",
39-
"laminas-api-tools/api-tools-versioning": "^1.2",
34+
"laminas-api-tools/api-tools-mvc-auth": "^1.6.0",
35+
"laminas-api-tools/api-tools-oauth2": "^1.7",
36+
"laminas-api-tools/api-tools-provider": "^1.4",
37+
"laminas-api-tools/api-tools-rest": "^1.6.0",
38+
"laminas-api-tools/api-tools-rpc": "^1.5",
39+
"laminas-api-tools/api-tools-versioning": "^1.4",
4040
"laminas/laminas-db": "^2.8.1",
4141
"laminas/laminas-eventmanager": "^2.6.3 || ^3.0.1",
4242
"laminas/laminas-loader": "^2.5.1",
@@ -49,7 +49,8 @@
4949
"require-dev": {
5050
"laminas/laminas-coding-standard": "~2.3.0",
5151
"laminas/laminas-http": "^2.5.4",
52-
"phpunit/phpunit": "^7.1.5"
52+
"phpspec/prophecy-phpunit": "^2.0",
53+
"phpunit/phpunit": "^9.3"
5354
},
5455
"suggest": {
5556
"alcaeus/mongo-php-adapter": "^1.0.5, if you are using ext/mongodb and wish to use the MongoConnectedListener.",

composer.lock

Lines changed: 1103 additions & 511 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

phpunit.xml.dist

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
4-
bootstrap="vendor/autoload.php"
5-
colors="true">
6-
<testsuites>
7-
<testsuite name="api-tools Test Suite">
8-
<directory>./test</directory>
9-
</testsuite>
10-
</testsuites>
11-
12-
<filter>
13-
<whitelist processUncoveredFilesFromWhitelist="true">
14-
<directory suffix=".php">./src</directory>
15-
</whitelist>
16-
</filter>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" bootstrap="vendor/autoload.php" colors="true">
3+
<coverage processUncoveredFiles="true">
4+
<include>
5+
<directory suffix=".php">./src</directory>
6+
</include>
7+
</coverage>
8+
<testsuites>
9+
<testsuite name="api-tools Test Suite">
10+
<directory>./test</directory>
11+
</testsuite>
12+
</testsuites>
1713
</phpunit>

src/DbConnectedResourceAbstractFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Laminas\ApiTools;
66

77
use Interop\Container\ContainerInterface;
8+
use Laminas\ApiTools\Rest\Resource;
89
use Laminas\Db\TableGateway\TableGatewayInterface;
910
use Laminas\Paginator\Paginator;
1011
use Laminas\ServiceManager\AbstractFactoryInterface;
@@ -169,8 +170,7 @@ protected function getIdentifierFromConfig(array $config)
169170
* @param array $config
170171
* @param string $requestedName
171172
* @return string
172-
* @throws ServiceNotCreatedException If the discovered collection class
173-
* does not exist.
173+
* @throws ServiceNotCreatedException If the discovered collection class does not exist.
174174
*/
175175
protected function getCollectionFromConfig(array $config, $requestedName)
176176
{

src/MvcAuth/UnauthenticatedListener.php

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

77
use Laminas\ApiTools\ApiProblem\ApiProblem;
88
use Laminas\ApiTools\ApiProblem\ApiProblemResponse;
9-
use Laminas\ApiTools\MvcAuth\MvcAuthEvent;
109

1110
class UnauthenticatedListener
1211
{

src/MvcAuth/UnauthorizedListener.php

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

77
use Laminas\ApiTools\ApiProblem\ApiProblem;
88
use Laminas\ApiTools\ApiProblem\ApiProblemResponse;
9-
use Laminas\ApiTools\MvcAuth\MvcAuthEvent;
109

1110
class UnauthorizedListener
1211
{

test/ApplicationTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,17 @@
1212
use Laminas\Mvc\MvcEvent;
1313
use Laminas\ServiceManager\ServiceManager;
1414
use PHPUnit\Framework\TestCase;
15+
use Prophecy\PhpUnit\ProphecyTrait;
1516
use Prophecy\Prophecy\ObjectProphecy;
17+
use ReflectionException;
1618
use ReflectionMethod;
1719
use ReflectionProperty;
1820

1921
class ApplicationTest extends TestCase
2022
{
21-
protected function setUp()
23+
use ProphecyTrait;
24+
25+
protected function setUp(): void
2226
{
2327
$events = new EventManager();
2428

@@ -86,6 +90,7 @@ public function setUpServices($services, EventManager $events, $request, $respon
8690
/**
8791
* @param ObjectProphecy&PhpEnvironment\Request $request
8892
* @param ObjectProphecy&PhpEnvironment\Response $response
93+
* @throws ReflectionException
8994
*/
9095
public function setUpMvcEvent(Application $app, $request, $response): Application
9196
{

test/AutoloaderTest.php

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

1414
class AutoloaderTest extends TestCase
1515
{
16+
/** @psalm-return array<string, array{0: class-string}> */
1617
public function classesToAutoload(): array
1718
{
1819
return [

test/DbConnectedResourceAbstractFactoryTest.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@
99
use Laminas\ApiTools\DbConnectedResourceAbstractFactory;
1010
use Laminas\Db\TableGateway\TableGateway;
1111
use PHPUnit\Framework\TestCase;
12+
use Prophecy\PhpUnit\ProphecyTrait;
1213

1314
class DbConnectedResourceAbstractFactoryTest extends TestCase
1415
{
15-
protected function setUp()
16+
use ProphecyTrait;
17+
18+
protected function setUp(): void
1619
{
1720
$this->services = $this->prophesize(ContainerInterface::class);
1821
$this->factory = new DbConnectedResourceAbstractFactory();
@@ -69,6 +72,7 @@ public function invalidConfig(): array
6972
}
7073

7174
/**
75+
* @param array $configForDbConnected
7276
* @dataProvider invalidConfig
7377
*/
7478
public function testWillNotCreateServiceIfDbConnectedSegmentIsInvalidConfiguration(
@@ -93,6 +97,7 @@ public function testWillNotCreateServiceIfDbConnectedSegmentIsInvalidConfigurati
9397
$this->assertFalse($this->factory->canCreate($this->services->reveal(), 'Foo'));
9498
}
9599

100+
/** @psalm-return array<string, array{0: array<string, string>, 1: string}> */
96101
public function validConfig(): array
97102
{
98103
return [
@@ -123,6 +128,7 @@ public function testWillCreateServiceIfDbConnectedSegmentIsValid(
123128
}
124129

125130
/**
131+
* @param array $configForDbConnected
126132
* @dataProvider validConfig
127133
*/
128134
public function testFactoryReturnsResourceBasedOnConfiguration(

0 commit comments

Comments
 (0)