|
2 | 2 |
|
3 | 3 | namespace Neo4j\QueryAPI\Tests\Unit\Authentication;
|
4 | 4 |
|
| 5 | +use DG\BypassFinals; |
5 | 6 | use Neo4j\QueryAPI\Authentication\NoAuth;
|
6 | 7 | use PHPUnit\Framework\TestCase;
|
7 | 8 | use Psr\Http\Message\RequestInterface;
|
8 | 9 |
|
9 |
| -class NoAuthUnitTest extends TestCase |
| 10 | +final class NoAuthUnitTest extends TestCase |
10 | 11 | {
|
11 |
| - public function testGetHeaderReturnsEmptyString() |
| 12 | + private NoAuth $auth; |
| 13 | + private RequestInterface $requestMock; |
| 14 | + |
| 15 | + #[\Override] |
| 16 | + protected function setUp(): void |
12 | 17 | {
|
13 |
| - $auth = new NoAuth(); |
14 |
| - $this->assertSame('', $auth->getHeader()); |
| 18 | + BypassFinals::enable(); |
| 19 | + |
| 20 | + $this->auth = new NoAuth(); |
| 21 | + $this->requestMock = $this->createMock(RequestInterface::class); |
15 | 22 | }
|
16 | 23 |
|
17 |
| - public function testGetTypeReturnsNoAuth() |
| 24 | + public function testAuthenticateReturnsUnmodifiedRequest(): void |
18 | 25 | {
|
19 |
| - $auth = new NoAuth(); |
20 |
| - $this->assertSame('NoAuth', $auth->getType()); |
| 26 | + $this->assertSame($this->requestMock, $this->auth->authenticate($this->requestMock)); |
21 | 27 | }
|
22 | 28 |
|
23 |
| - public function testAuthenticateReturnsSameRequest() |
| 29 | + public function testGetHeaderReturnsEmptyString(): void |
24 | 30 | {
|
| 31 | + $this->assertEquals('', $this->auth->getHeader()); |
| 32 | + } |
25 | 33 |
|
26 |
| - $requestMock = $this->createMock(RequestInterface::class); |
27 |
| - |
28 |
| - $auth = new NoAuth(); |
29 |
| - $result = $auth->authenticate($requestMock); |
30 |
| - |
31 |
| - $this->assertSame($requestMock, $result); |
| 34 | + public function testGetTypeReturnsNoAuth(): void |
| 35 | + { |
| 36 | + $this->assertEquals('NoAuth', $this->auth->getType()); |
32 | 37 | }
|
33 | 38 | }
|
0 commit comments