Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions Tests/Integration/Composer/ScriptsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ScriptsTest extends TestCase
*/
public function webDirectoryHasBeenCreated()
{
self::assertDirectoryExists($this->getAbsoluteWebDirectoryPath());
static::assertDirectoryExists($this->getAbsoluteWebDirectoryPath());
}

/**
Expand Down Expand Up @@ -48,15 +48,15 @@ public function webDirectoryFilesDataProvider(): array
*/
public function webDirectoryFilesExist(string $fileName)
{
self::assertFileExists($this->getAbsoluteWebDirectoryPath() . $fileName);
static::assertFileExists($this->getAbsoluteWebDirectoryPath() . $fileName);
}

/**
* @test
*/
public function binariesDirectoryHasBeenCreated()
{
self::assertDirectoryExists($this->getAbsoluteBinariesDirectoryPath());
static::assertDirectoryExists($this->getAbsoluteBinariesDirectoryPath());
}

/**
Expand Down Expand Up @@ -84,7 +84,7 @@ public function binariesDataProvider(): array
*/
public function binariesExist(string $fileName)
{
self::assertFileExists($this->getAbsoluteBinariesDirectoryPath() . $fileName);
static::assertFileExists($this->getAbsoluteBinariesDirectoryPath() . $fileName);
}

/**
Expand All @@ -100,7 +100,7 @@ private function getBundleConfigurationFilePath(): string
*/
public function bundleConfigurationFileExists()
{
self::assertFileExists($this->getBundleConfigurationFilePath());
static::assertFileExists($this->getBundleConfigurationFilePath());
}

/**
Expand All @@ -123,7 +123,7 @@ public function bundleConfigurationFileContainsModuleBundles(string $bundleClass
{
$fileContents = file_get_contents($this->getBundleConfigurationFilePath());

self::assertContains($bundleClassName, $fileContents);
static::assertContains($bundleClassName, $fileContents);
}

/**
Expand All @@ -139,7 +139,7 @@ private function getModuleRoutesConfigurationFilePath(): string
*/
public function moduleRoutesConfigurationFileExists()
{
self::assertFileExists($this->getModuleRoutesConfigurationFilePath());
static::assertFileExists($this->getModuleRoutesConfigurationFilePath());
}

/**
Expand All @@ -163,22 +163,22 @@ public function moduleRoutesConfigurationFileContainsModuleRoutes(string $routeS
{
$fileContents = file_get_contents($this->getModuleRoutesConfigurationFilePath());

self::assertContains($routeSearchString, $fileContents);
static::assertContains($routeSearchString, $fileContents);
}

/**
* @test
*/
public function parametersConfigurationFileExists()
{
self::assertFileExists(dirname(__DIR__, 3) . '/Configuration/parameters.yml');
static::assertFileExists(dirname(__DIR__, 3) . '/Configuration/parameters.yml');
}

/**
* @test
*/
public function modulesConfigurationFileExists()
{
self::assertFileExists(dirname(__DIR__, 3) . '/Configuration/config_modules.yml');
static::assertFileExists(dirname(__DIR__, 3) . '/Configuration/config_modules.yml');
}
}
20 changes: 10 additions & 10 deletions Tests/Integration/Controller/AbstractControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ protected function setUp()
$this->initializeDatabaseTester();
$this->bootstrap = Bootstrap::getInstance()->setEnvironment(Environment::TESTING)->configure();
$this->entityManager = $this->bootstrap->getEntityManager();
self::assertTrue($this->entityManager->isOpen());
static::assertTrue($this->entityManager->isOpen());

$this->client = self::createClient(['environment' => Environment::TESTING]);
$this->client = static::createClient(['environment' => Environment::TESTING]);
}

/**
Expand Down Expand Up @@ -226,8 +226,8 @@ protected function authenticatedJsonRequest(
array $server = [],
string $content = null
): Crawler {
$this->getDataSet()->addTable(self::ADMINISTRATOR_TABLE_NAME, __DIR__ . '/Fixtures/Administrator.csv');
$this->getDataSet()->addTable(self::TOKEN_TABLE_NAME, __DIR__ . '/Fixtures/AdministratorToken.csv');
$this->getDataSet()->addTable(static::ADMINISTRATOR_TABLE_NAME, __DIR__ . '/Fixtures/Administrator.csv');
$this->getDataSet()->addTable(static::TOKEN_TABLE_NAME, __DIR__ . '/Fixtures/AdministratorToken.csv');
$this->applyDatabaseChanges();

$serverWithAuthentication = $server;
Expand Down Expand Up @@ -256,7 +256,7 @@ protected function getDecodedJsonResponseContent(): array
*/
protected function assertJsonResponseContentEquals(array $expected)
{
self::assertSame($expected, $this->getDecodedJsonResponseContent());
static::assertSame($expected, $this->getDecodedJsonResponseContent());
}

/**
Expand All @@ -270,8 +270,8 @@ protected function assertHttpStatusWithJsonContentType(int $status)
{
$response = $this->client->getResponse();

self::assertSame($status, $response->getStatusCode());
self::assertContains('application/json', (string)$response->headers);
static::assertSame($status, $response->getStatusCode());
static::assertContains('application/json', (string)$response->headers);
}

/**
Expand Down Expand Up @@ -334,7 +334,7 @@ protected function assertHttpForbidden()
{
$this->assertHttpStatusWithJsonContentType(Response::HTTP_FORBIDDEN);

self::assertSame(
static::assertSame(
[
'code' => Response::HTTP_FORBIDDEN,
'message' => 'No valid session key was provided as basic auth password.',
Expand All @@ -352,7 +352,7 @@ protected function assertHttpMethodNotAllowed()
{
$response = $this->client->getResponse();

self::assertSame(Response::HTTP_METHOD_NOT_ALLOWED, $response->getStatusCode());
static::assertSame(Response::HTTP_METHOD_NOT_ALLOWED, $response->getStatusCode());
}

/**
Expand All @@ -365,7 +365,7 @@ protected function assertHttpConflict()
{
$this->assertHttpStatusWithJsonContentType(Response::HTTP_CONFLICT);

self::assertSame(
static::assertSame(
[
'code' => Response::HTTP_CONFLICT,
'message' => 'This resource already exists.',
Expand Down
26 changes: 13 additions & 13 deletions Tests/Integration/Controller/ListControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class ListControllerTest extends AbstractControllerTest
*/
public function controllerIsAvailableViaContainer()
{
self::assertInstanceOf(ListController::class, $this->client->getContainer()->get(ListController::class));
static::assertInstanceOf(ListController::class, $this->client->getContainer()->get(ListController::class));
}

/**
Expand All @@ -50,8 +50,8 @@ public function getListsWithoutSessionKeyReturnsForbiddenStatus()
*/
public function getListsWithExpiredSessionKeyReturnsForbiddenStatus()
{
$this->getDataSet()->addTable(self::ADMINISTRATOR_TABLE_NAME, __DIR__ . '/Fixtures/Administrator.csv');
$this->getDataSet()->addTable(self::TOKEN_TABLE_NAME, __DIR__ . '/Fixtures/AdministratorToken.csv');
$this->getDataSet()->addTable(static::ADMINISTRATOR_TABLE_NAME, __DIR__ . '/Fixtures/Administrator.csv');
$this->getDataSet()->addTable(static::TOKEN_TABLE_NAME, __DIR__ . '/Fixtures/AdministratorToken.csv');
$this->applyDatabaseChanges();

$this->client->request(
Expand Down Expand Up @@ -80,7 +80,7 @@ public function getListsWithCurrentSessionKeyReturnsOkayStatus()
*/
public function getListsWithCurrentSessionKeyReturnsListData()
{
$this->getDataSet()->addTable(self::LISTS_TABLE_NAME, __DIR__ . '/Fixtures/SubscriberList.csv');
$this->getDataSet()->addTable(static::LISTS_TABLE_NAME, __DIR__ . '/Fixtures/SubscriberList.csv');
$this->applyDatabaseChanges();

$this->authenticatedJsonRequest('get', '/api/v2/lists');
Expand Down Expand Up @@ -116,7 +116,7 @@ public function getListsWithCurrentSessionKeyReturnsListData()
*/
public function getListMembersForExistingListWithoutSessionKeyReturnsForbiddenStatus()
{
$this->getDataSet()->addTable(self::LISTS_TABLE_NAME, __DIR__ . '/Fixtures/SubscriberList.csv');
$this->getDataSet()->addTable(static::LISTS_TABLE_NAME, __DIR__ . '/Fixtures/SubscriberList.csv');
$this->applyDatabaseChanges();

$this->client->request('get', '/api/v2/lists/1/members');
Expand All @@ -129,9 +129,9 @@ public function getListMembersForExistingListWithoutSessionKeyReturnsForbiddenSt
*/
public function getListMembersForExistingListWithExpiredSessionKeyReturnsForbiddenStatus()
{
$this->getDataSet()->addTable(self::LISTS_TABLE_NAME, __DIR__ . '/Fixtures/SubscriberList.csv');
$this->getDataSet()->addTable(self::ADMINISTRATOR_TABLE_NAME, __DIR__ . '/Fixtures/Administrator.csv');
$this->getDataSet()->addTable(self::TOKEN_TABLE_NAME, __DIR__ . '/Fixtures/AdministratorToken.csv');
$this->getDataSet()->addTable(static::LISTS_TABLE_NAME, __DIR__ . '/Fixtures/SubscriberList.csv');
$this->getDataSet()->addTable(static::ADMINISTRATOR_TABLE_NAME, __DIR__ . '/Fixtures/Administrator.csv');
$this->getDataSet()->addTable(static::TOKEN_TABLE_NAME, __DIR__ . '/Fixtures/AdministratorToken.csv');
$this->applyDatabaseChanges();

$this->client->request(
Expand Down Expand Up @@ -160,7 +160,7 @@ public function getListMembersWithCurrentSessionKeyForInexistentListReturnsNotFo
*/
public function getListMembersWithCurrentSessionKeyForExistingListReturnsOkayStatus()
{
$this->getDataSet()->addTable(self::LISTS_TABLE_NAME, __DIR__ . '/Fixtures/SubscriberList.csv');
$this->getDataSet()->addTable(static::LISTS_TABLE_NAME, __DIR__ . '/Fixtures/SubscriberList.csv');
$this->applyDatabaseChanges();

$this->authenticatedJsonRequest('get', '/api/v2/lists/1/members');
Expand All @@ -173,7 +173,7 @@ public function getListMembersWithCurrentSessionKeyForExistingListReturnsOkaySta
*/
public function getListMembersWithCurrentSessionKeyForExistingListWithoutSubscribersReturnsEmptyArray()
{
$this->getDataSet()->addTable(self::LISTS_TABLE_NAME, __DIR__ . '/Fixtures/SubscriberList.csv');
$this->getDataSet()->addTable(static::LISTS_TABLE_NAME, __DIR__ . '/Fixtures/SubscriberList.csv');
$this->applyDatabaseChanges();

$this->authenticatedJsonRequest('get', '/api/v2/lists/1/members');
Expand All @@ -186,9 +186,9 @@ public function getListMembersWithCurrentSessionKeyForExistingListWithoutSubscri
*/
public function getListMembersWithCurrentSessionKeyForExistingListWithSubscribersReturnsSubscribers()
{
$this->getDataSet()->addTable(self::LISTS_TABLE_NAME, __DIR__ . '/Fixtures/SubscriberList.csv');
$this->getDataSet()->addTable(self::SUBSCRIBER_TABLE_NAME, __DIR__ . '/Fixtures/Subscriber.csv');
$this->getDataSet()->addTable(self::SUBSCRIPTION_TABLE_NAME, __DIR__ . '/Fixtures/Subscription.csv');
$this->getDataSet()->addTable(static::LISTS_TABLE_NAME, __DIR__ . '/Fixtures/SubscriberList.csv');
$this->getDataSet()->addTable(static::SUBSCRIBER_TABLE_NAME, __DIR__ . '/Fixtures/Subscriber.csv');
$this->getDataSet()->addTable(static::SUBSCRIPTION_TABLE_NAME, __DIR__ . '/Fixtures/Subscription.csv');
$this->applyDatabaseChanges();

$this->authenticatedJsonRequest('get', '/api/v2/lists/2/members');
Expand Down
19 changes: 11 additions & 8 deletions Tests/Integration/Controller/SessionControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ protected function setUp()
*/
public function controllerIsAvailableViaContainer()
{
self::assertInstanceOf(SessionController::class, $this->client->getContainer()->get(SessionController::class));
static::assertInstanceOf(
SessionController::class,
$this->client->getContainer()->get(SessionController::class)
);
}

/**
Expand Down Expand Up @@ -130,7 +133,7 @@ public function postSessionsWithValidIncompleteJsonReturnsError400(string $jsonD
*/
public function postSessionsWithInvalidCredentialsReturnsNotAuthorized()
{
$this->getDataSet()->addTable(self::ADMINISTRATOR_TABLE_NAME, __DIR__ . '/Fixtures/Administrator.csv');
$this->getDataSet()->addTable(static::ADMINISTRATOR_TABLE_NAME, __DIR__ . '/Fixtures/Administrator.csv');
$this->applyDatabaseChanges();

$loginName = 'john.doe';
Expand All @@ -153,7 +156,7 @@ public function postSessionsWithInvalidCredentialsReturnsNotAuthorized()
*/
public function postSessionsActionWithValidCredentialsReturnsCreatedHttpStatus()
{
$this->getDataSet()->addTable(self::ADMINISTRATOR_TABLE_NAME, __DIR__ . '/Fixtures/Administrator.csv');
$this->getDataSet()->addTable(static::ADMINISTRATOR_TABLE_NAME, __DIR__ . '/Fixtures/Administrator.csv');
$this->applyDatabaseChanges();

$loginName = 'john.doe';
Expand All @@ -171,7 +174,7 @@ public function postSessionsActionWithValidCredentialsReturnsCreatedHttpStatus()
public function postSessionsActionWithValidCredentialsCreatesToken()
{
$administratorId = 1;
$this->getDataSet()->addTable(self::ADMINISTRATOR_TABLE_NAME, __DIR__ . '/Fixtures/Administrator.csv');
$this->getDataSet()->addTable(static::ADMINISTRATOR_TABLE_NAME, __DIR__ . '/Fixtures/Administrator.csv');
$this->applyDatabaseChanges();

$loginName = 'john.doe';
Expand All @@ -187,9 +190,9 @@ public function postSessionsActionWithValidCredentialsCreatesToken()

/** @var AdministratorToken $token */
$token = $this->administratorTokenRepository->find($tokenId);
self::assertNotNull($token);
self::assertSame($key, $token->getKey());
self::assertSame($expiry, $token->getExpiry()->format(\DateTime::ATOM));
self::assertSame($administratorId, $token->getAdministrator()->getId());
static::assertNotNull($token);
static::assertSame($key, $token->getKey());
static::assertSame($expiry, $token->getExpiry()->format(\DateTime::ATOM));
static::assertSame($administratorId, $token->getAdministrator()->getId());
}
}
30 changes: 15 additions & 15 deletions Tests/Integration/Controller/SubscriberControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected function setUp()
*/
public function controllerIsAvailableViaContainer()
{
self::assertInstanceOf(
static::assertInstanceOf(
SubscriberController::class,
$this->client->getContainer()->get(SubscriberController::class)
);
Expand Down Expand Up @@ -68,7 +68,7 @@ public function postSubscribersWithoutSessionKeyReturnsForbiddenStatus()
*/
public function postSubscribersWithValidSessionKeyAndMinimalValidSubscriberDataCreatesResource()
{
$this->touchDatabaseTable(self::SUBSCRIBER_TABLE_NAME);
$this->touchDatabaseTable(static::SUBSCRIBER_TABLE_NAME);

$email = 'subscriber@example.com';
$jsonData = ['email' => $email];
Expand All @@ -83,7 +83,7 @@ public function postSubscribersWithValidSessionKeyAndMinimalValidSubscriberDataC
*/
public function postSubscribersWithValidSessionKeyAndMinimalValidDataReturnsIdAndUniqueId()
{
$this->touchDatabaseTable(self::SUBSCRIBER_TABLE_NAME);
$this->touchDatabaseTable(static::SUBSCRIBER_TABLE_NAME);

$email = 'subscriber@example.com';
$jsonData = ['email' => $email];
Expand All @@ -92,16 +92,16 @@ public function postSubscribersWithValidSessionKeyAndMinimalValidDataReturnsIdAn

$responseContent = $this->getDecodedJsonResponseContent();

self::assertGreaterThan(0, $responseContent['id']);
self::assertRegExp('/^[0-9a-f]{32}$/', $responseContent['unique_id']);
static::assertGreaterThan(0, $responseContent['id']);
static::assertRegExp('/^[0-9a-f]{32}$/', $responseContent['unique_id']);
}

/**
* @test
*/
public function postSubscribersWithValidSessionKeyAndValidDataCreatesSubscriber()
{
$this->touchDatabaseTable(self::SUBSCRIBER_TABLE_NAME);
$this->touchDatabaseTable(static::SUBSCRIBER_TABLE_NAME);

$email = 'subscriber@example.com';
$jsonData = ['email' => $email];
Expand All @@ -111,15 +111,15 @@ public function postSubscribersWithValidSessionKeyAndValidDataCreatesSubscriber(
$responseContent = $this->getDecodedJsonResponseContent();

$subscriberId = $responseContent['id'];
self::assertInstanceOf(Subscriber::class, $this->subscriberRepository->find($subscriberId));
static::assertInstanceOf(Subscriber::class, $this->subscriberRepository->find($subscriberId));
}

/**
* @test
*/
public function postSubscribersWithValidSessionKeyAndExistingEmailAddressCreatesConflictStatus()
{
$this->getDataSet()->addTable(self::SUBSCRIBER_TABLE_NAME, __DIR__ . '/Fixtures/Subscriber.csv');
$this->getDataSet()->addTable(static::SUBSCRIBER_TABLE_NAME, __DIR__ . '/Fixtures/Subscriber.csv');
$this->applyDatabaseChanges();

$email = 'oliver@example.com';
Expand Down Expand Up @@ -159,7 +159,7 @@ public function invalidSubscriberDataProvider(): array
*/
public function postSubscribersWithInvalidDataCreatesUnprocessableEntityStatus(array $jsonData)
{
$this->touchDatabaseTable(self::SUBSCRIBER_TABLE_NAME);
$this->touchDatabaseTable(static::SUBSCRIBER_TABLE_NAME);

$this->authenticatedJsonRequest('post', '/api/v2/subscribers', [], [], [], json_encode($jsonData));

Expand All @@ -171,7 +171,7 @@ public function postSubscribersWithInvalidDataCreatesUnprocessableEntityStatus(a
*/
public function postSubscribersWithValidSessionKeyAssignsProvidedSubscriberData()
{
$this->touchDatabaseTable(self::SUBSCRIBER_TABLE_NAME);
$this->touchDatabaseTable(static::SUBSCRIBER_TABLE_NAME);

$email = 'subscriber@example.com';
$jsonData = [
Expand All @@ -186,10 +186,10 @@ public function postSubscribersWithValidSessionKeyAssignsProvidedSubscriberData(

$responseContent = $this->getDecodedJsonResponseContent();

self::assertSame($email, $responseContent['email']);
self::assertTrue($responseContent['confirmed']);
self::assertTrue($responseContent['blacklisted']);
self::assertTrue($responseContent['html_email']);
self::assertTrue($responseContent['disabled']);
static::assertSame($email, $responseContent['email']);
static::assertTrue($responseContent['confirmed']);
static::assertTrue($responseContent['blacklisted']);
static::assertTrue($responseContent['html_email']);
static::assertTrue($responseContent['disabled']);
}
}
Loading