Skip to content

Commit

Permalink
Change function name to Countsubscribers, fix the tests
Browse files Browse the repository at this point in the history
Signed-off-by: Xheni Myrtaj <[email protected]>
  • Loading branch information
xh3n1 committed Apr 3, 2019
1 parent ba0c892 commit b5985f6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/Controller/ListController.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public function getMembersAction(Request $request, SubscriberList $list): View
*
* @return View
*/
public function getCountAction(Request $request, SubscriberList $list): View
public function getCountsubscribersAction(Request $request, SubscriberList $list): View
{
$this->requireAuthentication($request);

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 @@ -335,20 +335,20 @@ public function getListMembersWithCurrentSessionKeyForExistingListWithSubscriber
/**
* @test
*/
public function getListCountForExistingListWithoutSessionKeyReturnsForbiddenStatus()
public function getListCountsubscribersForExistingListWithoutSessionKeyReturnsForbiddenStatus()
{
$this->getDataSet()->addTable(static::LISTS_TABLE_NAME, __DIR__ . '/Fixtures/SubscriberList.csv');
$this->applyDatabaseChanges();

$this->client->request('get', '/api/v2/lists/1/count');
$this->client->request('get', '/api/v2/lists/1/countsubscribers');

$this->assertHttpForbidden();
}

/**
* @test
*/
public function getListCountForExistingListWithExpiredSessionKeyReturnsForbiddenStatus()
public function getListCountsubscribersForExistingListWithExpiredSessionKeyReturnsForbiddenStatus()
{
$this->getDataSet()->addTable(static::LISTS_TABLE_NAME, __DIR__ . '/Fixtures/SubscriberList.csv');
$this->getDataSet()->addTable(static::ADMINISTRATOR_TABLE_NAME, __DIR__ . '/Fixtures/Administrator.csv');
Expand All @@ -357,7 +357,7 @@ public function getListCountForExistingListWithExpiredSessionKeyReturnsForbidden

$this->client->request(
'get',
'/api/v2/lists/1/count',
'/api/v2/lists/1/countsubscribers',
[],
[],
['PHP_AUTH_USER' => 'unused', 'PHP_AUTH_PW' => 'cfdf64eecbbf336628b0f3071adba763']
Expand All @@ -369,45 +369,45 @@ public function getListCountForExistingListWithExpiredSessionKeyReturnsForbidden
/**
* @test
*/
public function getListCountWithCurrentSessionKeyForExistingListReturnsOkayStatus()
public function getListCountsubscribersWithCurrentSessionKeyForExistingListReturnsOkayStatus()
{
$this->getDataSet()->addTable(static::LISTS_TABLE_NAME, __DIR__ . '/Fixtures/SubscriberList.csv');
$this->applyDatabaseChanges();

$this->authenticatedJsonRequest('get', '/api/v2/lists/1/count');
$this->authenticatedJsonRequest('get', '/api/v2/lists/1/countsubscribers');

$this->assertHttpOkay();
}

/**
* @test
*/
public function getListCountWithCurrentSessionKeyForExistingListWithSubscribersReturnsSubscribersCount()
public function getListCountsubscribersWithCurrentSessionKeyForExistingListWithNoSubscribersReturnsZero()
{
$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/count');
$this->authenticatedJsonRequest('get', '/api/v2/lists/3/countsubscribers');
$response = $this->getResponseContentAsInt();
static::assertSame(1, $response);

static::assertSame(0, $response);
}

/**
* @test
*/
public function getListCountWithCurrentSessionKeyForExistingListWithNoSubscribersReturnsZero()
public function getListCountsubscribersWithCurrentSessionKeyForExistingListWithSubscribersReturnsSubscribersCount()
{
$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/3/count');
$this->authenticatedJsonRequest('get', '/api/v2/lists/2/countsubscribers');
$response = $this->getResponseContentAsInt();

static::assertSame(0, $response);
static::assertSame(1, $response);
}
}

0 comments on commit b5985f6

Please sign in to comment.