Skip to content

Commit 671609a

Browse files
committed
Use PHPUnit 8.5
1 parent 658a35e commit 671609a

File tree

5 files changed

+23
-14
lines changed

5 files changed

+23
-14
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.phpunit.result.cache
12
build
23
composer.lock
34
vendor

Dockerfile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,4 @@ RUN curl -o /tmp/composer-setup.php https://getcomposer.org/installer && \
1717
php /tmp/composer-setup.php && \
1818
mv composer.phar /usr/local/bin/composer
1919

20-
RUN wget -O phpunit https://phar.phpunit.de/phpunit-7.phar && \
21-
chmod +x phpunit && \
22-
mv phpunit /usr/local/bin/phpunit
23-
2420
WORKDIR app

Makefile

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,32 @@
1-
PHPUNIT=$(shell which phpunit)
1+
PHPUNIT_VERSION = phpunit-8.5.phar
2+
PHPUNIT_FILENAME = build/$(PHPUNIT_VERSION)
3+
PHPUNIT = php $(PHPUNIT_FILENAME)
24

35
vendor:
46
@composer install
57

8+
$(PHPUNIT_FILENAME):
9+
mkdir -p build
10+
curl -o $(PHPUNIT_FILENAME) -L https://phar.phpunit.de/$(PHPUNIT_VERSION)
11+
612
test: test-setup
7-
@php -d xdebug.coverage_enable=0 $(PHPUNIT)
13+
@$(PHPUNIT)
814

915
test-coverage: test-setup
1016
@mkdir -p build/coverage
1117
@$(PHPUNIT) --coverage-html build/coverage
1218

1319
test-coveralls: test-setup
1420
@mkdir -p build/logs
15-
composer require satooshi/php-coveralls '^2.0'
21+
composer require php-coveralls/php-coveralls '^2.0'
1622
@$(PHPUNIT) --coverage-clover build/logs/clover.xml
1723
php vendor/bin/php-coveralls -v
1824

1925
test-container:
2026
@docker-compose run --rm app sh
2127
@docker-compose down
2228

23-
test-setup: vendor
29+
test-setup: vendor $(PHPUNIT_FILENAME)
2430
@rm -f tests/sandbox/*
2531

2632
.PHONY: all test test-container test-coverage test-coveralls test-setup

tests/InterfaceResolver/BasicInterfaceResolverTest.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use ArrayIterator;
1515
use DateTimeImmutable;
1616
use DateTimeInterface;
17+
use LogicException;
1718
use olvlvl\SymfonyDependencyInjectionProxy\InterfaceResolver\BasicInterfaceResolver;
1819
use PHPUnit\Framework\TestCase;
1920

@@ -24,25 +25,29 @@ class BasicInterfaceResolverTest extends TestCase
2425
{
2526
/**
2627
* @test
27-
* @expectedException \LogicException
28-
* @expectedExceptionMessageRegExp /Don't know which interface to choose from for ArrayIterator: Iterator,/
2928
* @throws \Exception
3029
*/
3130
public function shouldFailIfClassImplementsManyInterfaces()
3231
{
3332
$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+
);
3438
$stu->resolveInterface(ArrayIterator::class);
3539
}
3640

3741
/**
3842
* @test
39-
* @expectedException \LogicException
40-
* @expectedExceptionMessage Unable to determine the interface to implement for anUndefinedClass.
4143
* @throws \Exception
4244
*/
4345
public function shouldFailIfClassDoesNotExist()
4446
{
4547
$stu = new BasicInterfaceResolver();
48+
49+
$this->expectException(LogicException::class);
50+
$this->expectExceptionMessage("Unable to determine the interface to implement for anUndefinedClass.");
4651
$stu->resolveInterface('anUndefinedClass');
4752
}
4853

tests/ProxyDumperTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use ArrayAccess;
1515
use ArrayIterator;
1616
use ArrayObject;
17+
use InvalidArgumentException;
1718
use olvlvl\SymfonyDependencyInjectionProxy\FactoryRenderer;
1819
use olvlvl\SymfonyDependencyInjectionProxy\InterfaceResolver;
1920
use olvlvl\SymfonyDependencyInjectionProxy\ProxyDumper;
@@ -65,8 +66,6 @@ public function provideIsProxyCandidate(): array
6566
/**
6667
* @test
6768
* @dataProvider provideEmptyFactoryCode
68-
* @expectedException \InvalidArgumentException
69-
* @expectedExceptionMessage Missing factory code to construct the service `aServiceId`.
7069
* @throws \Exception
7170
*/
7271
public function shouldFailIfFactoryCodeIsEmpty($factoryCode)
@@ -76,6 +75,8 @@ public function shouldFailIfFactoryCodeIsEmpty($factoryCode)
7675
$this->prophesize(FactoryRenderer::class)->reveal()
7776
);
7877

78+
$this->expectException(InvalidArgumentException::class);
79+
$this->expectExceptionMessage("Missing factory code to construct the service `aServiceId`.");
7980
$stu->getProxyFactoryCode(new Definition(), 'aServiceId', $factoryCode);
8081
}
8182

0 commit comments

Comments
 (0)