File tree Expand file tree Collapse file tree 5 files changed +23
-14
lines changed Expand file tree Collapse file tree 5 files changed +23
-14
lines changed Original file line number Diff line number Diff line change
1
+ .phpunit.result.cache
1
2
build
2
3
composer.lock
3
4
vendor
Original file line number Diff line number Diff line change @@ -17,8 +17,4 @@ RUN curl -o /tmp/composer-setup.php https://getcomposer.org/installer && \
17
17
php /tmp/composer-setup.php && \
18
18
mv composer.phar /usr/local/bin/composer
19
19
20
- RUN wget -O phpunit https://phar.phpunit.de/phpunit-7.phar && \
21
- chmod +x phpunit && \
22
- mv phpunit /usr/local/bin/phpunit
23
-
24
20
WORKDIR app
Original file line number Diff line number Diff line change 1
- PHPUNIT =$(shell which phpunit)
1
+ PHPUNIT_VERSION = phpunit-8.5.phar
2
+ PHPUNIT_FILENAME = build/$(PHPUNIT_VERSION )
3
+ PHPUNIT = php $(PHPUNIT_FILENAME )
2
4
3
5
vendor :
4
6
@composer install
5
7
8
+ $(PHPUNIT_FILENAME ) :
9
+ mkdir -p build
10
+ curl -o $(PHPUNIT_FILENAME ) -L https://phar.phpunit.de/$(PHPUNIT_VERSION )
11
+
6
12
test : test-setup
7
- @php -d xdebug.coverage_enable=0 $(PHPUNIT )
13
+ @$(PHPUNIT )
8
14
9
15
test-coverage : test-setup
10
16
@mkdir -p build/coverage
11
17
@$(PHPUNIT ) --coverage-html build/coverage
12
18
13
19
test-coveralls : test-setup
14
20
@mkdir -p build/logs
15
- composer require satooshi /php-coveralls ' ^2.0'
21
+ composer require php-coveralls /php-coveralls ' ^2.0'
16
22
@$(PHPUNIT ) --coverage-clover build/logs/clover.xml
17
23
php vendor/bin/php-coveralls -v
18
24
19
25
test-container :
20
26
@docker-compose run --rm app sh
21
27
@docker-compose down
22
28
23
- test-setup : vendor
29
+ test-setup : vendor $( PHPUNIT_FILENAME )
24
30
@rm -f tests/sandbox/*
25
31
26
32
.PHONY : all test test-container test-coverage test-coveralls test-setup
Original file line number Diff line number Diff line change 14
14
use ArrayIterator ;
15
15
use DateTimeImmutable ;
16
16
use DateTimeInterface ;
17
+ use LogicException ;
17
18
use olvlvl \SymfonyDependencyInjectionProxy \InterfaceResolver \BasicInterfaceResolver ;
18
19
use PHPUnit \Framework \TestCase ;
19
20
@@ -24,25 +25,29 @@ class BasicInterfaceResolverTest extends TestCase
24
25
{
25
26
/**
26
27
* @test
27
- * @expectedException \LogicException
28
- * @expectedExceptionMessageRegExp /Don't know which interface to choose from for ArrayIterator: Iterator,/
29
28
* @throws \Exception
30
29
*/
31
30
public function shouldFailIfClassImplementsManyInterfaces ()
32
31
{
33
32
$ stu = new BasicInterfaceResolver ();
33
+
34
+ $ this ->expectException (LogicException::class);
35
+ $ this ->expectExceptionMessageMatches (
36
+ "/Don't know which interface to choose from for ArrayIterator: Iterator,/ "
37
+ );
34
38
$ stu ->resolveInterface (ArrayIterator::class);
35
39
}
36
40
37
41
/**
38
42
* @test
39
- * @expectedException \LogicException
40
- * @expectedExceptionMessage Unable to determine the interface to implement for anUndefinedClass.
41
43
* @throws \Exception
42
44
*/
43
45
public function shouldFailIfClassDoesNotExist ()
44
46
{
45
47
$ stu = new BasicInterfaceResolver ();
48
+
49
+ $ this ->expectException (LogicException::class);
50
+ $ this ->expectExceptionMessage ("Unable to determine the interface to implement for anUndefinedClass. " );
46
51
$ stu ->resolveInterface ('anUndefinedClass ' );
47
52
}
48
53
Original file line number Diff line number Diff line change 14
14
use ArrayAccess ;
15
15
use ArrayIterator ;
16
16
use ArrayObject ;
17
+ use InvalidArgumentException ;
17
18
use olvlvl \SymfonyDependencyInjectionProxy \FactoryRenderer ;
18
19
use olvlvl \SymfonyDependencyInjectionProxy \InterfaceResolver ;
19
20
use olvlvl \SymfonyDependencyInjectionProxy \ProxyDumper ;
@@ -65,8 +66,6 @@ public function provideIsProxyCandidate(): array
65
66
/**
66
67
* @test
67
68
* @dataProvider provideEmptyFactoryCode
68
- * @expectedException \InvalidArgumentException
69
- * @expectedExceptionMessage Missing factory code to construct the service `aServiceId`.
70
69
* @throws \Exception
71
70
*/
72
71
public function shouldFailIfFactoryCodeIsEmpty ($ factoryCode )
@@ -76,6 +75,8 @@ public function shouldFailIfFactoryCodeIsEmpty($factoryCode)
76
75
$ this ->prophesize (FactoryRenderer::class)->reveal ()
77
76
);
78
77
78
+ $ this ->expectException (InvalidArgumentException::class);
79
+ $ this ->expectExceptionMessage ("Missing factory code to construct the service `aServiceId`. " );
79
80
$ stu ->getProxyFactoryCode (new Definition (), 'aServiceId ' , $ factoryCode );
80
81
}
81
82
You can’t perform that action at this time.
0 commit comments