@@ -36,10 +36,7 @@ private function getMockLogger(): LoggerInterface
3636
3737 public function testDetermineRenderer ()
3838 {
39- $ handler = $ this
40- ->getMockBuilder (ErrorHandler::class)
41- ->disableOriginalConstructor ()
42- ->getMock ();
39+ $ handler = $ this ->createMock (ErrorHandler::class);
4340 $ class = new ReflectionClass (ErrorHandler::class);
4441
4542 $ callableResolverProperty = $ class ->getProperty ('callableResolver ' );
@@ -77,10 +74,7 @@ public function testDetermineRenderer()
7774 public function testDetermineStatusCode ()
7875 {
7976 $ request = $ this ->createServerRequest ('/ ' );
80- $ handler = $ this
81- ->getMockBuilder (ErrorHandler::class)
82- ->disableOriginalConstructor ()
83- ->getMock ();
77+ $ handler = $ this ->createMock (ErrorHandler::class);
8478 $ class = new ReflectionClass (ErrorHandler::class);
8579
8680 $ reflectionProperty = $ class ->getProperty ('responseFactory ' );
@@ -129,10 +123,7 @@ public function testHalfValidContentType()
129123 ->createServerRequest ('/ ' , 'GET ' )
130124 ->withHeader ('Content-Type ' , 'unknown/json+ ' );
131125
132- $ handler = $ this
133- ->getMockBuilder (ErrorHandler::class)
134- ->disableOriginalConstructor ()
135- ->getMock ();
126+ $ handler = $ this ->createMock (ErrorHandler::class);
136127 $ newErrorRenderers = [
137128 'application/xml ' => XmlErrorRenderer::class,
138129 'text/xml ' => XmlErrorRenderer::class,
@@ -164,10 +155,7 @@ public function testDetermineContentTypeTextPlainMultiAcceptHeader()
164155 ->withHeader ('Content-Type ' , 'text/plain ' )
165156 ->withHeader ('Accept ' , 'text/plain,text/xml ' );
166157
167- $ handler = $ this
168- ->getMockBuilder (ErrorHandler::class)
169- ->disableOriginalConstructor ()
170- ->getMock ();
158+ $ handler = $ this ->createMock (ErrorHandler::class);
171159
172160 $ errorRenderers = [
173161 'text/plain ' => PlainTextErrorRenderer::class,
@@ -199,10 +187,7 @@ public function testDetermineContentTypeApplicationJsonOrXml()
199187 ->withHeader ('Content-Type ' , 'text/json ' )
200188 ->withHeader ('Accept ' , 'application/xhtml+xml ' );
201189
202- $ handler = $ this
203- ->getMockBuilder (ErrorHandler::class)
204- ->disableOriginalConstructor ()
205- ->getMock ();
190+ $ handler = $ this ->createMock (ErrorHandler::class);
206191
207192 $ errorRenderers = [
208193 'application/xml ' => XmlErrorRenderer::class
@@ -242,10 +227,7 @@ public function testAcceptableMediaTypeIsNotFirstInList()
242227 $ method ->setAccessible (true );
243228
244229 // use a mock object here as ErrorHandler cannot be directly instantiated
245- $ handler = $ this
246- ->getMockBuilder (ErrorHandler::class)
247- ->disableOriginalConstructor ()
248- ->getMock ();
230+ $ handler = $ this ->createMock (ErrorHandler::class);
249231
250232 // call determineContentType()
251233 $ return = $ method ->invoke ($ handler , $ request );
0 commit comments