mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 01:25:55 +02:00
Applied rector suggestions
This commit is contained in:
parent
4106bcef5f
commit
20f32c7f12
170 changed files with 808 additions and 761 deletions
|
@ -34,7 +34,7 @@ class APITokenAuthenticationTest extends ApiTestCase
|
|||
self::ensureKernelShutdown();
|
||||
$client = static::createClient();
|
||||
$client->request('GET', '/api/parts');
|
||||
self::assertResponseStatusCodeSame(401);
|
||||
$this->assertResponseStatusCodeSame(401);
|
||||
}
|
||||
|
||||
public function testExpiredToken(): void
|
||||
|
@ -42,7 +42,7 @@ class APITokenAuthenticationTest extends ApiTestCase
|
|||
self::ensureKernelShutdown();
|
||||
$client = $this->createClientWithCredentials(APITokenFixtures::TOKEN_EXPIRED);
|
||||
$client->request('GET', '/api/parts');
|
||||
self::assertResponseStatusCodeSame(401);
|
||||
$this->assertResponseStatusCodeSame(401);
|
||||
}
|
||||
|
||||
public function testReadOnlyToken(): void
|
||||
|
@ -52,14 +52,14 @@ class APITokenAuthenticationTest extends ApiTestCase
|
|||
|
||||
//Read should be possible
|
||||
$client->request('GET', '/api/parts');
|
||||
self::assertResponseIsSuccessful();
|
||||
$this->assertResponseIsSuccessful();
|
||||
|
||||
//Trying to list all users and create a new footprint should fail
|
||||
$client->request('GET', '/api/users');
|
||||
self::assertResponseStatusCodeSame(403);
|
||||
$this->assertResponseStatusCodeSame(403);
|
||||
|
||||
$client->request('POST', '/api/footprints', ['json' => ['name' => 'post test']]);
|
||||
self::assertResponseStatusCodeSame(403);
|
||||
$this->assertResponseStatusCodeSame(403);
|
||||
}
|
||||
|
||||
public function testEditToken(): void
|
||||
|
@ -69,14 +69,14 @@ class APITokenAuthenticationTest extends ApiTestCase
|
|||
|
||||
//Read should be possible
|
||||
$client->request('GET', '/api/parts');
|
||||
self::assertResponseIsSuccessful();
|
||||
$this->assertResponseIsSuccessful();
|
||||
|
||||
//Trying to list all users
|
||||
$client->request('GET', '/api/users');
|
||||
self::assertResponseStatusCodeSame(403);
|
||||
$this->assertResponseStatusCodeSame(403);
|
||||
|
||||
$client->request('POST', '/api/footprints', ['json' => ['name' => 'post test']]);
|
||||
self::assertResponseIsSuccessful();
|
||||
$this->assertResponseIsSuccessful();
|
||||
}
|
||||
|
||||
public function testAdminToken(): void
|
||||
|
@ -86,14 +86,14 @@ class APITokenAuthenticationTest extends ApiTestCase
|
|||
|
||||
//Read should be possible
|
||||
$client->request('GET', '/api/parts');
|
||||
self::assertResponseIsSuccessful();
|
||||
$this->assertResponseIsSuccessful();
|
||||
|
||||
//Trying to list all users
|
||||
$client->request('GET', '/api/users');
|
||||
self::assertResponseIsSuccessful();
|
||||
$this->assertResponseIsSuccessful();
|
||||
|
||||
$client->request('POST', '/api/footprints', ['json' => ['name' => 'post test']]);
|
||||
self::assertResponseIsSuccessful();
|
||||
$this->assertResponseIsSuccessful();
|
||||
}
|
||||
|
||||
public function testWithAuthorizationToken(): void
|
||||
|
@ -104,14 +104,14 @@ class APITokenAuthenticationTest extends ApiTestCase
|
|||
|
||||
//Read should be possible
|
||||
$client->request('GET', '/api/parts');
|
||||
self::assertResponseIsSuccessful();
|
||||
$this->assertResponseIsSuccessful();
|
||||
|
||||
//Trying to list all users
|
||||
$client->request('GET', '/api/users');
|
||||
self::assertResponseIsSuccessful();
|
||||
$this->assertResponseIsSuccessful();
|
||||
|
||||
$client->request('POST', '/api/footprints', ['json' => ['name' => 'post test']]);
|
||||
self::assertResponseIsSuccessful();
|
||||
$this->assertResponseIsSuccessful();
|
||||
}
|
||||
|
||||
protected function createClientWithCredentials(string $token): Client
|
||||
|
|
|
@ -30,9 +30,9 @@ class ApiTokenEnpointTest extends AuthenticatedApiTestCase
|
|||
public function testGetCurrentToken(): void
|
||||
{
|
||||
$response = self::createAuthenticatedClient()->request('GET', '/api/tokens/current');
|
||||
self::assertResponseIsSuccessful();
|
||||
$this->assertResponseIsSuccessful();
|
||||
|
||||
self::assertJsonContains([
|
||||
$this->assertJsonContains([
|
||||
'name' => 'admin',
|
||||
'level' => 3,
|
||||
]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue