Skip to content

Commit

Permalink
More specific function name and moved the test
Browse files Browse the repository at this point in the history
Signed-off-by: Xheni Myrtaj <[email protected]>
  • Loading branch information
xh3n1 committed Mar 19, 2019
1 parent ba0c892 commit 2068fc2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 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
20 changes: 10 additions & 10 deletions tests/Integration/Controller/ListControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ public function getListMembersWithCurrentSessionKeyForExistingListWithSubscriber
/**
* @test
*/
public function getListCountForExistingListWithoutSessionKeyReturnsForbiddenStatus()
public function getListCountSubscribersForExistingListWithoutSessionKeyReturnsForbiddenStatus()
{
$this->getDataSet()->addTable(static::LISTS_TABLE_NAME, __DIR__ . '/Fixtures/SubscriberList.csv');
$this->applyDatabaseChanges();
Expand All @@ -348,7 +348,7 @@ public function getListCountForExistingListWithoutSessionKeyReturnsForbiddenStat
/**
* @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 @@ -369,7 +369,7 @@ public function getListCountForExistingListWithExpiredSessionKeyReturnsForbidden
/**
* @test
*/
public function getListCountWithCurrentSessionKeyForExistingListReturnsOkayStatus()
public function getListCountSubscribersWithCurrentSessionKeyForExistingListReturnsOkayStatus()
{
$this->getDataSet()->addTable(static::LISTS_TABLE_NAME, __DIR__ . '/Fixtures/SubscriberList.csv');
$this->applyDatabaseChanges();
Expand All @@ -382,32 +382,32 @@ public function getListCountWithCurrentSessionKeyForExistingListReturnsOkayStatu
/**
* @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/count');
$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/count');
$response = $this->getResponseContentAsInt();

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

0 comments on commit 2068fc2

Please sign in to comment.