Skip to content

Commit

Permalink
update functional test (#1001)
Browse files Browse the repository at this point in the history
* update functional test

* fix functional test

* update composer
  • Loading branch information
alavieille committed Jul 25, 2016
1 parent d0047f5 commit 1346d41
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 24 deletions.
24 changes: 12 additions & 12 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function testHomepageWithTree()
$this->assertEquals(1, $crawler->filter('a:contains("Community")')->count());
$this->assertEquals(2, $crawler->filter('a:contains("News")')->count());
$this->assertEquals(1, $crawler->filter('a:contains("Legal Notice")')->count());
$this->assertEquals(1, $crawler->filter('a:contains("Home")')->count());
$this->assertEquals(2, $crawler->filter('a:contains("Home")')->count());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,11 @@ public function provideContentTypeAndPaginateAndSearchAndsiteId()
* @param integer $count
*
* @dataProvider provideContentTypeCount
* @deprecated will be removed in 2.0, use countByContentTypeAndSiteInLastVersion
*/
public function testCountByContentTypeInLastVersion($contentType, $count)
{
@trigger_error('The '.__METHOD__.' method is deprecated since version 1.1.3 and will be removed in 2.0. Use the '.__CLASS__.'::countByContentTypeAndSiteInLastVersion method instead.', E_USER_DEPRECATED);
$contents = $this->repository->countByContentTypeInLastVersion($contentType);
$this->assertEquals($count, $contents);
}
Expand All @@ -336,34 +338,71 @@ public function provideContentTypeCount()
);
}

/**
* @param string $contentType
* @param string $siteId
* @param integer $count
*
* @dataProvider provideCountByContentTypeAndSiteInLastVersion
*/
public function testCountByContentTypeAndSiteInLastVersion($contentType, $siteId, $count)
{
$contents = $this->repository->countByContentTypeAndSiteInLastVersion($contentType, $siteId);
$this->assertEquals($count, $contents);
}

/**
* @return array
*/
public function provideCountByContentTypeAndSiteInLastVersion()
{
return array(
array('car', '1', 2),
array('car', '2', 3),
array('customer', '1', 1),
array('customer', '2', 1),
array('news', '1', 3),
array('news', '2', 4),
);
}

/**
* @param string $contentType
* @param array $descriptionEntity
* @param string $search
* @param string $siteId
* @param int $count
*
* @dataProvider provideColumnsAndSearchAndCount
*/
public function testCountByContentTypeInLastVersionWithSearchFilter($contentType, $descriptionEntity, $search, $count)
{
public function testCountByContentTypeInLastVersionWithSearchFilter(
$contentType,
$descriptionEntity,
$search,
$siteId,
$count
) {
$configuration = FinderConfiguration::generateFromVariable($descriptionEntity, $search);

$sites = $this->repository->countByContentTypeInLastVersionWithFilter($contentType, $configuration);
$this->assertEquals($count, $sites);
$contents = $this->repository->countByContentTypeInLastVersionWithFilter($contentType, $configuration, $siteId);
$this->assertEquals($count, $contents);
}

/**
* @return array
*/
public function provideColumnsAndSearchAndCount()
{
$descriptionEntity = $this->getDescriptionColumnEntity();

return array(
array('car', $descriptionEntity, $this->generateColumnsProvider(array('name' => '206')), 1),
array('car', $descriptionEntity, $this->generateColumnsProvider(null, 'portes'), 2),
array('news', $descriptionEntity, $this->generateColumnsProvider(null, 'news'), 0),
array('news', $descriptionEntity, $this->generateColumnsProvider(null, 'lorem'), 1),
array('car', $descriptionEntity, $this->generateColumnsProvider(array('name' => '206')), '1', 1),
array('car', $descriptionEntity, $this->generateColumnsProvider(array('name' => '206')), '2', 1),
array('car', $descriptionEntity, $this->generateColumnsProvider(array('name' => 'DS 3')), '1', 0),
array('car', $descriptionEntity, $this->generateColumnsProvider(array('name' => 'DS 3')), '2', 1),
array('car', $descriptionEntity, $this->generateColumnsProvider(null, 'portes'), '1', 2),
array('car', $descriptionEntity, $this->generateColumnsProvider(null, 'portes'), '2', 2),
array('news', $descriptionEntity, $this->generateColumnsProvider(null, 'news'), '1', 0),
array('news', $descriptionEntity, $this->generateColumnsProvider(null, 'news'), '2', 0),
array('news', $descriptionEntity, $this->generateColumnsProvider(null, 'lorem'), '1', 1),
array('news', $descriptionEntity, $this->generateColumnsProvider(null, 'lorem'), '2', 1),
);
}

Expand Down

0 comments on commit 1346d41

Please sign in to comment.