public function test_it_syncs_fields_for_instances() { $instances = []; $collectionFields = []; $pageVersionId = 1; $output = $this->CollectionsRepository->syncFieldsForInstances($instances, $collectionFields, $pageVersionId); assertCount(0, $output); }
/** * @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']); }
/** * @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']); } }
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]); }
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); }
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']); }
/** * @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); } }
/** * @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')); }
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); }
/** * @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']); }
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()); }
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); }
/** * @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')); }
/** * @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')); }
/** * @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); }
public function test_it_gets_sibling_menu_items() { $this->createMenu(); assertCount(0, $this->MenusRepository->getSiblingMenuItems('Name')); }
public function test_it_can_get_paginated_list_of_languages() { $output = $this->LanguagesRepository->languages(); assertCount(201, $output); }
/** @test */ public function it_can_build_and_persist_multiple_times() { $posts = TestDummy::times(3)->create('Post'); assertInstanceOf('Illuminate\\Support\\Collection', $posts); assertCount(3, $posts); }
/** * @Then /^the "([^"]*)" property should contain (\d+) item(?:|s)$/ */ public function thePropertyContainsItems($property, $count) { $payload = $this->getScopePayload(); assertCount($count, $this->arrayGet($payload, $property), "Asserting the [{$property}] property contains [{$count}] items: " . json_encode($payload)); }
public function test_it_gets_pages_list() { $expectedSize = \DB::table('dvs_pages')->count(); $list = $this->PagesRepository->getPagesList($includeAdmin = true); assertCount($expectedSize, $list); }
/** * @Then Assert the array :arg1 count :integer elements * * @param $haystack * @param $expectedCount */ public function assertCount($haystack, $expectedCount) { $expectedCount = (int) $expectedCount; assertCount($expectedCount, $haystack, sprintf("Assert the array [%s] don't have [%s] elements, but [%s].", print_r($haystack, true), $expectedCount, count($haystack))); }
public function test_it_can_get_with_comments_and_empty_lines() { $settings = $this->EnvironmentFileManager->get($file = null, $settingsOnly = false); assertCount(17, $settings); assertEquals('local', $settings['APP_ENV']); }
/** * @Then /^(?:the )?response should contain json:$/ */ public function assertResponseShouldContainJson(PyStringNode $jsonString) { $etalon = json_decode($this->replacePlaceHolder($jsonString->getRaw()), true); $actual = json_decode($this->getSession()->getPage()->getContent(), true); if (null === $etalon) { throw new \RuntimeException("Can not convert etalon to json:\n" . $this->replacePlaceHolder($jsonString->getRaw())); } assertCount(count($etalon), $actual); $this->recursiveArrayKeysCheck($actual, $etalon); }
/** * @Then the list :listName should have :count users */ public function theListShouldHaveRecipients($listName, $count) { assertCount($count, $this->userRepository->findBy($this->lists[$listName])); }
/** * Checks that response body contains JSON from PyString. * * @param PyStringNode $jsonString * * @Then /^(?:the )?response should contain json:$/ */ public function theResponseShouldContainJson(PyStringNode $jsonString) { $etalon = json_decode($this->replacePlaceHolder($jsonString->getRaw()), true); $actual = json_decode($this->browser->getLastResponse()->getContent(), true); if (null === $etalon) { throw new \RuntimeException("Can not convert etalon to json:\n" . $this->replacePlaceHolder($jsonString->getRaw())); } assertCount(count($etalon), $actual); foreach ($actual as $key => $needle) { assertArrayHasKey($key, $etalon); assertEquals($etalon[$key], $actual[$key]); } }
function 以下の単元に何も表示されていないこと($css_sessions) { $page = $this->getSession()->getPage(); $div = $page->find('css', $css_sessions); $courses = $div->findAll('css', '.movieviewer-course'); assertCount(0, $courses); }
/** * @Given /^parent results of batch is (\d+)$/ */ public function parentResultsOfBatchIs($arg) { assertCount($arg, $this->scope_array['batch_parent_requests'][0]->batch_child_requests); }
public function test_it_extracts_images() { assertCount(0, $this->Manager->extractImagesForCallback([])); }
public function test_it_fetches_events() { assertCount(1, $this->PageVersionSource->fetchEvents('2015-01-01 00:00:00', '2015-01-21 00:00:00')); }
/** * @Given /^the "([^"]*)" property count is (\d+)$/ */ public function thePropertyCountIs($arg1, $arg2) { $results = $this->getResponsePayload(); $countable = (array) $results->data->{$arg1}; assertCount($arg2, $countable); }