本文整理汇总了PHP中assertCount函数的典型用法代码示例。如果您正苦于以下问题:PHP assertCount函数的具体用法?PHP assertCount怎么用?PHP assertCount使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了assertCount函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_it_syncs_fields_for_instances
public function test_it_syncs_fields_for_instances()
{
$instances = [];
$collectionFields = [];
$pageVersionId = 1;
$output = $this->CollectionsRepository->syncFieldsForInstances($instances, $collectionFields, $pageVersionId);
assertCount(0, $output);
}
示例2: theOutputShouldBeAJsonContainingProductSInfoWithAsTheTotalPrice
/**
* @Then the output should be a Json containing :productCount product's info with :totalPrice as the total price
*/
public function theOutputShouldBeAJsonContainingProductSInfoWithAsTheTotalPrice($productCount, $totalPrice)
{
$result = $this->commandTester->getDisplay();
assertJson($result);
$resultToArray = json_decode($result, true);
assertCount((int) $productCount, $resultToArray['result']);
assertEquals((double) $totalPrice, $resultToArray['total']);
}
示例3: theFollowingRepositoriesAreVisible
/**
* @Then /^The following repositories are visible:$/
*/
public function theFollowingRepositoriesAreVisible(TableNode $table)
{
$tableHash = $table->getHash();
assertCount(count($tableHash), $this->getSession()->getPage()->findAll('css', '.repositories .repository'));
foreach ($tableHash as $row) {
$this->assertPageContainsText($row['type']);
$this->assertPageContainsText($row['url']);
}
}
示例4: test_it_creates_pristine_section
public function test_it_creates_pristine_section()
{
$parser = new DeviseParser();
$traverser = new NodeTraverser();
$traverser->addVisitor(new CreatePristineSection($parser));
$nodes = $parser->parse($this->fixture('devise-views.interpret3'));
$nodes = $traverser->traverse($nodes);
assertCount(1, $nodes);
assertInstanceOf('PhpParser\\Node\\Stmt\\If_', $nodes[0]);
}
示例5: test_it_can_traverse_nodes
public function test_it_can_traverse_nodes()
{
$parser = new DeviseParser();
$traverser = new NodeTraverser();
$traverser->addVisitor(new AddPlaceHolderTags($parser));
$nodes = $parser->parse($this->fixture('devise-views.interpret3'));
$nodes = $traverser->traverse($nodes);
assertCount(4, $nodes);
assertEquals('<span data-dvs-placeholder="key1" data-dvs-placeholder="key2" data-dvs-placeholder="key3"></span>', $nodes[1]->value);
}
示例6: test_it_can_search_thru_items
public function test_it_can_search_thru_items()
{
$mockedResult = new MockedSearchResult();
$item1 = m::mock('Devise\\Search\\Searchable');
$item1->shouldReceive('search')->andReturn($mockedResult);
$this->search->register($item1);
$outcome = $this->search->search('asdf');
assertInstanceOf('Devise\\Search\\Pagination', $outcome);
assertCount(1, $outcome->toArray()['items']);
}
示例7: unpackFilesToTheSameDirectory
/**
* @Given /^Unpack files to the same directory:$/
*/
public function unpackFilesToTheSameDirectory(PyStringNode $string)
{
$expectedFiles = $string->getLines();
$this->pagesDir = $this->package->unpack($expectedFiles);
assertFileExists($this->pagesDir);
chdir($this->pagesDir);
$foundFiles = array_flip(glob('*.html'));
assertCount(count($expectedFiles), $foundFiles);
foreach ($expectedFiles as $file) {
assertArrayHasKey($file, $foundFiles);
}
}
示例8: downloadManualFromPackageFrom
/**
* @Then /^download manual from "([^"]*)" package from "([^"]*)"$/
*/
public function downloadManualFromPackageFrom($lang, $mirror)
{
$this->package = new Package($lang, $mirror);
$dir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'php-doc-parser-test';
@mkdir($dir);
$file = $dir . DIRECTORY_SEPARATOR . $this->package->getOrigFilename();
$this->package->download($file);
$testUnpackDir = $this->package->unpack(array_map(function ($item) {
return $item['source-filename'];
}, $this->testFiles));
$this->unpackedFilesDir = $this->package->getUnpackedDir();
assertEquals($testUnpackDir, $this->unpackedFilesDir);
assertCount(count($this->testFiles), glob($this->unpackedFilesDir . DIRECTORY_SEPARATOR . '*.html'));
}
示例9: test_it_gets_devise_tags
public function test_it_gets_devise_tags()
{
$tags = $this->DeviseParser->getDeviseTags($this->fixture('devise-views.interpret3'));
assertCount(4, $tags);
assertEquals("key1", $tags[0]->id);
assertEquals("field", $tags[0]->bindingType);
assertEquals(null, $tags[0]->collection);
assertEquals("key1", $tags[0]->key);
assertEquals("type", $tags[0]->type);
assertEquals("Human name 1", $tags[0]->humanName);
assertEquals(null, $tags[0]->group);
assertEquals(null, $tags[0]->category);
assertEquals(null, $tags[0]->alternateTarget);
assertEquals(null, $tags[0]->defaults);
assertEquals(" data-devise=\"key1, type, Human name 1\"", $tags[0]->value);
assertEquals("key2", $tags[1]->id);
assertEquals("field", $tags[1]->bindingType);
assertEquals(null, $tags[1]->collection);
assertEquals("key2", $tags[1]->key);
assertEquals("type", $tags[1]->type);
assertEquals("Human name 2", $tags[1]->humanName);
assertEquals(null, $tags[1]->group);
assertEquals(null, $tags[1]->category);
assertEquals(null, $tags[1]->alternateTarget);
assertEquals(null, $tags[1]->defaults);
assertEquals(" data-devise=\"key2, type, Human name 2\"", $tags[1]->value);
assertEquals("key3", $tags[2]->id);
assertEquals("field", $tags[2]->bindingType);
assertEquals(null, $tags[2]->collection);
assertEquals("key3", $tags[2]->key);
assertEquals("type", $tags[2]->type);
assertEquals("Human name 3", $tags[2]->humanName);
assertEquals(null, $tags[2]->group);
assertEquals(null, $tags[2]->category);
assertEquals(null, $tags[2]->alternateTarget);
assertEquals(null, $tags[2]->defaults);
assertEquals(" data-devise=\"key3, type, Human name 3\"", $tags[2]->value);
assertEquals("outside", $tags[3]->id);
assertEquals("field", $tags[3]->bindingType);
assertEquals(null, $tags[3]->collection);
assertEquals("outside", $tags[3]->key);
assertEquals("type", $tags[3]->type);
assertEquals("Outside Key", $tags[3]->humanName);
assertEquals(null, $tags[3]->group);
assertEquals(null, $tags[3]->category);
assertEquals(null, $tags[3]->alternateTarget);
assertEquals(null, $tags[3]->defaults);
assertEquals(" data-devise=\"outside, type, Outside Key\"", $tags[3]->value);
}
示例10: fixVersion_getAppliedList
/**
* @test
*/
function fixVersion_getAppliedList()
{
$this->table->fixVersion("987654");
$rows = $this->pdo->query("select * from db_migrate")->fetchAll();
assertCount(1, $rows);
assertEquals("987654", $rows[0]['version']);
$this->table->fixVersion("123456");
$rows = $this->pdo->query("select * from db_migrate order by version")->fetchAll();
assertCount(2, $rows);
assertEquals("123456", $rows[0]['version']);
assertEquals("987654", $rows[1]['version']);
$rows = $this->table->getAppliedList();
assertCount(2, $rows);
assertEquals("123456", $rows[0]['version']);
assertEquals("987654", $rows[1]['version']);
}
示例11: test_it_creates_fields
public function test_it_creates_fields()
{
$page = ['page_version_id' => 50, 'page_id' => 42, 'language_id' => 45];
$fields = [['id' => 'Name', 'model_type' => 'DvsTestModel', 'mapping' => 'Name', 'values' => ['text' => 'the name here']]];
$previousFieldCount = \DvsModelField::count();
$previousModelCount = \DvsTestModel::count();
list($createdFields, $createdModel) = $this->ModelManager->createFieldsAndModel($fields, $page);
$modelField = \DvsModelField::find($createdFields[0]->id);
$model = $modelField->model;
assertCount(1, $createdFields);
assertEquals($createdModel->id, $model->id);
assertEquals(50, $model->page_version_id);
assertEquals('the name here', $model->name);
assertEquals($previousFieldCount + 1, \DvsModelField::count());
assertEquals($previousModelCount + 1, \DvsTestModel::count());
}
示例12: test_it_can_traverse_nodes
public function test_it_can_traverse_nodes()
{
$parser = new DeviseParser();
$traverser = new NodeTraverser();
$traverser->addVisitor(new EchoDeviseMagic($parser));
$nodes = $parser->parse($this->fixture('devise-views.interpret7'));
$nodes = $traverser->traverse($nodes);
assertCount(6, $nodes);
// dd($nodes[0]);
assertEquals('dvsmagic', $nodes[0]->exprs[0]->name);
// dd($nodes[1]);
assertEquals('dvsmagic', $nodes[1]->exprs[0]->name);
// dd($nodes[2]);
assertEquals('dvsmagic', $nodes[2]->exprs[0]->name);
// dd($nodes[3]);
assertEquals('dvsmagic', $nodes[3]->exprs[0]->if->name);
// dd($nodes[4]);
assertEquals('dvsmagic', $nodes[4]->exprs[0]->left->left->name);
// dd($nodes[5]);
assertEquals('dvsmagic', $nodes[5]->exprs[0]->args[0]->value->name);
}
示例13: flatMappingShouldBeCorrectWithEqualsKeysInResult
/**
* @depends shouldBeAvailableAsPairsSet
*
* @test
*/
public function flatMappingShouldBeCorrectWithEqualsKeysInResult()
{
// Assume we have map with 3 pairs.
$map = $this->dayNames;
$map = $map->flatMapBy(function ($key, $element) {
return array(array('some_key', $key), array('some_element', $element));
});
// All keys will be merged.
assertCount(2, $map);
assertTrue($map->containsKey('some_key'));
assertTrue($map->containsKey('some_element'));
}
示例14: iShouldSeeRowsInTheTable
/**
* @Then /^I should see (\d+) rows in the table$/
*/
public function iShouldSeeRowsInTheTable($rows)
{
$table = $this->getPage()->find('css', '.main-content table');
assertNotNull($table, 'Cannot find a table!');
assertCount(intval($rows), $table->findAll('css', 'tbody tr'));
}
示例15: theListShouldHaveIds
/**
* @Then the list :listName should have the ids :ids
*/
public function theListShouldHaveIds($listName, $ids)
{
$resultIds = $this->userRepository->findIdsBy($this->lists[$listName]);
$expectedIds = array_map('trim', explode(',', $ids));
$idDiff = array_diff($resultIds, $expectedIds);
assertEquals(array(), $idDiff);
assertCount(count($expectedIds), $resultIds);
}