@@ -12,7 +12,7 @@ using `PHPUnit`_. At first, install PHPUnit as a development dependency:
12
12
13
13
.. code-block :: terminal
14
14
15
- $ composer require --dev phpunit/phpunit:^9.6
15
+ $ composer require --dev phpunit/phpunit:^10.0
16
16
17
17
Then, create a PHPUnit configuration file in ``example.com/phpunit.xml.dist ``:
18
18
@@ -21,16 +21,16 @@ Then, create a PHPUnit configuration file in ``example.com/phpunit.xml.dist``:
21
21
<?xml version =" 1.0" encoding =" UTF-8" ?>
22
22
<phpunit
23
23
xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
24
- xsi : noNamespaceSchemaLocation =" https://schema.phpunit.de/9.6 /phpunit.xsd"
24
+ xsi : noNamespaceSchemaLocation =" https://schema.phpunit.de/10.0 /phpunit.xsd"
25
25
backupGlobals =" false"
26
26
colors =" true"
27
27
bootstrap =" vendor/autoload.php"
28
28
>
29
- <coverage processUncoveredFiles = " true " >
29
+ <source >
30
30
<include >
31
31
<directory suffix =" .php" >./src</directory >
32
32
</include >
33
- </coverage >
33
+ </source >
34
34
35
35
<testsuites >
36
36
<testsuite name =" Test Suite" >
@@ -103,12 +103,12 @@ We are now ready to write our first test::
103
103
$matcher
104
104
->expects($this->once())
105
105
->method('match')
106
- ->will($this->throwException($ exception) )
106
+ ->willThrowException($ exception)
107
107
;
108
108
$matcher
109
109
->expects($this->once())
110
110
->method('getContext')
111
- ->will ($this->returnValue($this-> createMock(Routing\RequestContext::class) ))
111
+ ->willReturn ($this->createMock(Routing\RequestContext::class))
112
112
;
113
113
$controllerResolver = $this->createMock(ControllerResolverInterface::class);
114
114
$argumentResolver = $this->createMock(ArgumentResolverInterface::class);
@@ -161,16 +161,16 @@ Response::
161
161
$matcher
162
162
->expects($this->once())
163
163
->method('match')
164
- ->will($this->returnValue ([
164
+ ->willReturn ([
165
165
'_route' => 'is_leap_year/{year}',
166
166
'year' => '2000',
167
167
'_controller' => [new LeapYearController(), 'index'],
168
- ]))
168
+ ])
169
169
;
170
170
$matcher
171
171
->expects($this->once())
172
172
->method('getContext')
173
- ->will ($this->returnValue($this-> createMock(Routing\RequestContext::class) ))
173
+ ->willReturn ($this->createMock(Routing\RequestContext::class))
174
174
;
175
175
$controllerResolver = new ControllerResolver();
176
176
$argumentResolver = new ArgumentResolver();
@@ -194,7 +194,7 @@ coverage feature (you need to enable `XDebug`_ first):
194
194
195
195
$ ./vendor/bin/phpunit --coverage-html=cov/
196
196
197
- Open ``example.com/cov/src/ Simplex/Framework.php.html `` in a browser and check
197
+ Open ``example.com/cov/Simplex/Framework.php.html `` in a browser and check
198
198
that all the lines for the Framework class are green (it means that they have
199
199
been visited when the tests were executed).
200
200
@@ -212,6 +212,6 @@ Symfony code.
212
212
Now that we are confident (again) about the code we have written, we can
213
213
safely think about the next batch of features we want to add to our framework.
214
214
215
- .. _`PHPUnit` : https://docs.phpunit.de/en/9.6 /
216
- .. _`test doubles` : https://docs.phpunit.de/en/9.6 /test-doubles.html
215
+ .. _`PHPUnit` : https://docs.phpunit.de/en/10.0 /
216
+ .. _`test doubles` : https://docs.phpunit.de/en/10.0 /test-doubles.html
217
217
.. _`XDebug` : https://xdebug.org/
0 commit comments