File tree Expand file tree Collapse file tree 10 files changed +22
-42
lines changed Expand file tree Collapse file tree 10 files changed +22
-42
lines changed Original file line number Diff line number Diff line change 1
1
language : php
2
2
matrix :
3
3
include :
4
- - php : 7.2
5
- env : EXECUTE_DEPLOYMENT=true
6
- - php : 7.3
4
+ - php : 7.4
7
5
env : deps=low
8
6
- php : 7.4
7
+ env : EXECUTE_DEPLOYMENT=true
9
8
fast_finish : true
10
9
before_install :
11
10
- phpenv config-rm xdebug.ini || echo "XDebug not enabled"
Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ package: tools/box
71
71
72
72
cd build/phar && \
73
73
composer remove phpunit/phpunit --no-update && \
74
- composer config platform.php 7.2 && \
74
+ composer config platform.php 7.4 && \
75
75
composer update --no-dev -o -a
76
76
77
77
tools/box compile
@@ -93,16 +93,16 @@ tools/deptrac:
93
93
curl -Ls http://get.sensiolabs.de/deptrac.phar -o tools/deptrac && chmod +x tools/deptrac
94
94
95
95
tools/infection : tools/infection.pubkey
96
- curl -Ls https://github.com/infection/infection/releases/download/0.15.0 /infection.phar -o tools/infection && chmod +x tools/infection
96
+ curl -Ls https://github.com/infection/infection/releases/download/0.15.1 /infection.phar -o tools/infection && chmod +x tools/infection
97
97
98
98
tools/infection.pubkey :
99
- curl -Ls https://github.com/infection/infection/releases/download/0.15.0 /infection.phar.pubkey -o tools/infection.pubkey
99
+ curl -Ls https://github.com/infection/infection/releases/download/0.15.1 /infection.phar.pubkey -o tools/infection.pubkey
100
100
101
101
tools/box :
102
102
curl -Ls https://github.com/humbug/box/releases/download/3.8.4/box.phar -o tools/box && chmod +x tools/box
103
103
104
104
tests/phar/tools/phpunit :
105
- curl -Ls https://phar.phpunit.de/phpunit-8 .phar -o tests/phar/tools/phpunit && chmod +x tests/phar/tools/phpunit
105
+ curl -Ls https://phar.phpunit.de/phpunit-9 .phar -o tests/phar/tools/phpunit && chmod +x tests/phar/tools/phpunit
106
106
107
107
tests/phar/tools/phpunit.d/zalas-phpunit-injector-extension.phar : build/zalas-phpunit-injector-extension.phar
108
108
cp build/zalas-phpunit-injector-extension.phar tests/phar/tools/phpunit.d/zalas-phpunit-injector-extension.phar
Original file line number Diff line number Diff line change @@ -73,18 +73,10 @@ class ServiceInjectorTest extends TestCase implements ServiceContainerTestCase
73
73
*/
74
74
private LoggerInterface $logger;
75
75
76
- /**
77
- * @var LoggerInterface
78
- * @inject
79
- */
80
- private $anotherLogger;
81
-
82
-
83
76
public function testThatServicesAreInjected()
84
77
{
85
78
$this->assertInstanceOf(SerializerInterface::class, $this->serializer, 'The service is injectd by its type');
86
79
$this->assertInstanceOf(LoggerInterface::class, $this->logger, 'The service is injected by its id');
87
- $this->assertInstanceOf(LoggerInterface::class, $this->anotherLogger, 'The service is injected by its @var type');
88
80
}
89
81
90
82
public function createServiceContainer(): ContainerInterface
@@ -95,7 +87,6 @@ class ServiceInjectorTest extends TestCase implements ServiceContainerTestCase
95
87
```
96
88
97
89
The service is found by its type, or an id if it's given in the ` @inject ` tag.
98
- In legacy PHP versions the ` @var ` annotation can be used.
99
90
100
91
The ` createServiceContainer ` method would be usually provided by a base test case or a trait.
101
92
In case of Symfony, such a trait is provided by this package (see the next section).
Original file line number Diff line number Diff line change 3
3
"description" : " Injects services from a PSR-11 dependency injection container to PHPUnit test cases" ,
4
4
"type" : " library" ,
5
5
"require" : {
6
- "php" : " ^7.2 ,<8.0" ,
7
- "phpunit/phpunit" : " ^8 .0" ,
6
+ "php" : " ^7.4 ,<8.0" ,
7
+ "phpunit/phpunit" : " ^9 .0" ,
8
8
"psr/container" : " ^1.0" ,
9
- "zalas/injector" : " ^1.3 "
9
+ "zalas/injector" : " ^2.0 "
10
10
},
11
11
"require-dev" : {
12
12
"symfony/config" : " ^3.4 || ^4.4 || ^5.0" ,
13
13
"symfony/dependency-injection" : " ^3.4 || ^4.4 || ^5.0" ,
14
14
"symfony/http-kernel" : " ^3.4 || ^4.4 || ^5.0" ,
15
15
"zalas/phpunit-globals" : " ^2.0" ,
16
16
"symfony/framework-bundle" : " ^3.4 || ^4.4 || ^5.0" ,
17
- "zalas/phpunit-doubles" : " ^1.2 " ,
17
+ "zalas/phpunit-doubles" : " ^1.4 " ,
18
18
"phpspec/prophecy" : " ^1.9"
19
19
},
20
20
"autoload" : {
36
36
],
37
37
"extra" : {
38
38
"branch-alias" : {
39
- "dev-master" : " 1 .x-dev"
39
+ "dev-master" : " 2 .x-dev"
40
40
}
41
41
}
42
42
}
Original file line number Diff line number Diff line change 1
1
<?xml version =" 1.0" encoding =" utf-8" ?>
2
2
<phar xmlns =" https://phar.io/xml/manifest/1.0" >
3
3
<contains name =" zalas/phpunit-injector" version =" @@version@@" type =" extension" >
4
- <extension for =" phpunit/phpunit" compatible =" ^8 .0" />
4
+ <extension for =" phpunit/phpunit" compatible =" ^9 .0" />
5
5
</contains >
6
6
7
7
<copyright >
10
10
</copyright >
11
11
12
12
<requires >
13
- <php version =" ^7.2 " />
13
+ <php version =" ^7.4 " />
14
14
</requires >
15
15
</phar >
Original file line number Diff line number Diff line change 1
1
<?xml version =" 1.0" encoding =" UTF-8" ?>
2
2
<phpunit xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
3
- xsi : noNamespaceSchemaLocation =" https://schema.phpunit.de/8 .0/phpunit.xsd"
3
+ xsi : noNamespaceSchemaLocation =" https://schema.phpunit.de/9 .0/phpunit.xsd"
4
4
bootstrap =" vendor/autoload.php"
5
5
beStrictAboutOutputDuringTests =" true"
6
6
beStrictAboutTodoAnnotatedTests =" true"
Original file line number Diff line number Diff line change @@ -15,16 +15,14 @@ class SymfonyContainerTest extends TestCase implements ServiceContainerTestCase
15
15
use SymfonyContainer;
16
16
17
17
/**
18
- * @var Service1
19
18
* @inject
20
19
*/
21
- private $ service1 ;
20
+ private Service1 $ service1 ;
22
21
23
22
/**
24
- * @var Service2
25
23
* @inject foo.service2
26
24
*/
27
- private $ service2 ;
25
+ private Service2 $ service2 ;
28
26
29
27
/**
30
28
* @env KERNEL_CLASS=Zalas\Injector\PHPUnit\Tests\Symfony\TestCase\Fixtures\NoFrameworkBundle\TestKernel
Original file line number Diff line number Diff line change 6
6
class Services
7
7
{
8
8
/**
9
- * @var Service1
10
9
* @inject
11
10
*/
12
- private $ service1 ;
11
+ private Service1 $ service1 ;
13
12
14
13
/**
15
- * @var Service2
16
14
* @inject foo.service2
17
15
*/
18
- private $ service2 ;
16
+ private Service2 $ service2 ;
19
17
20
18
public function getService1 (): ?Service1
21
19
{
Original file line number Diff line number Diff line change 16
16
class ServiceInjectorListenerTest extends TestCase implements ServiceContainerTestCase
17
17
{
18
18
/**
19
- * @var Service1
20
19
* @inject
21
20
*/
22
- private $ service1 ;
21
+ private Service1 $ service1 ;
23
22
24
23
/**
25
- * @var Service2
26
24
* @inject foo.service2
27
25
*/
28
- private $ service2 ;
26
+ private Service2 $ service2 ;
29
27
30
- /**
31
- * @var Service2
32
- */
33
- private $ service2NotInjected ;
28
+ private ?Service2 $ service2NotInjected = null ;
34
29
35
30
public function test_it_is_a_phpunit_listener ()
36
31
{
Original file line number Diff line number Diff line change 9
9
class PharTest extends TestCase implements ServiceContainerTestCase
10
10
{
11
11
/**
12
- * @var stdClass
13
12
* @inject foo.service
14
13
*/
15
- private $ service ;
14
+ private stdClass $ service ;
16
15
17
16
public function test_it_injects_services_into_test_cases ()
18
17
{
You can’t perform that action at this time.
0 commit comments