Skip to content

Commit ae085cf

Browse files
PratikshaPratiksha
authored andcommitted
enabled the mocking of final classes in PHPUnit
1 parent a4d171f commit ae085cf

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

tests/Unit/Authentication/NoAuthUnitTest.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Neo4j\QueryAPI\Tests\Unit\Authentication;
44

5+
use DG\BypassFinals;
56
use Neo4j\QueryAPI\Authentication\NoAuth;
67
use PHPUnit\Framework\TestCase;
78
use Psr\Http\Message\RequestInterface;
@@ -10,16 +11,18 @@ final class NoAuthUnitTest extends TestCase
1011
{
1112
private NoAuth $auth;
1213
private RequestInterface $requestMock;
13-
#[\Override]
14+
15+
#[\Override]
1416
protected function setUp(): void
1517
{
18+
BypassFinals::enable();
19+
1620
$this->auth = new NoAuth();
1721
$this->requestMock = $this->createMock(RequestInterface::class);
1822
}
1923

2024
public function testAuthenticateReturnsUnmodifiedRequest(): void
2125
{
22-
2326
$this->assertSame($this->requestMock, $this->auth->authenticate($this->requestMock));
2427
}
2528

tests/bootstrap.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?php
22

3-
use DG\BypassFinals;
43

54
require __DIR__ . '/../vendor/autoload.php';
65

7-
BypassFinals::enable();
6+
DG\BypassFinals::enable();

0 commit comments

Comments
 (0)