Commit a0500293 authored by catch's avatar catch
Browse files

Issue #3135538 by mondrake, longwave, jungle: Replace remaining assert*...

Issue #3135538 by mondrake, longwave, jungle: Replace remaining assert* involving use of count() where relevant
parent c71e7e4e
......@@ -387,14 +387,14 @@ protected function assertBigPipePlaceholders(array $expected_big_pipe_placeholde
$placeholders = array_map(function (NodeElement $element) {
return $element->getAttribute('data-big-pipe-placeholder-id');
}, $this->cssSelect('[data-big-pipe-placeholder-id]'));
$this->assertEqual(count($expected_big_pipe_placeholders), count(array_unique($placeholders)));
$this->assertSame(count($expected_big_pipe_placeholders), count(array_unique($placeholders)));
$expected_big_pipe_placeholders_with_replacements = [];
foreach ($expected_big_pipe_placeholder_stream_order as $big_pipe_placeholder_id) {
$expected_big_pipe_placeholders_with_replacements[$big_pipe_placeholder_id] = $expected_big_pipe_placeholders[$big_pipe_placeholder_id];
}
$this->assertEqual($expected_big_pipe_placeholders_with_replacements, array_filter($expected_big_pipe_placeholders));
$this->assertSetsEqual(array_keys($expected_big_pipe_placeholders_with_replacements), array_values($placeholder_replacement_positions));
$this->assertEqual(count($expected_big_pipe_placeholders_with_replacements), preg_match_all('/' . preg_quote('<script type="application/vnd.drupal-ajax" data-big-pipe-replacement-for-placeholder-with-id="', '/') . '/', $this->getSession()->getPage()->getContent()));
$this->assertSame(count($expected_big_pipe_placeholders_with_replacements), preg_match_all('/' . preg_quote('<script type="application/vnd.drupal-ajax" data-big-pipe-replacement-for-placeholder-with-id="', '/') . '/', $this->getSession()->getPage()->getContent()));
$this->pass('Verifying BigPipe start/stop signals…', 'Debug');
$this->assertRaw(BigPipe::START_SIGNAL, 'BigPipe start signal present.');
......
......@@ -63,7 +63,7 @@ public function testNewDefaultThemeBlocks() {
$new_blocks = $block_storage->getQuery()
->condition('theme', $new_theme)
->execute();
$this->assertEquals(count($default_block_names), count($new_blocks));
$this->assertSame(count($default_block_names), count($new_blocks));
foreach ($default_block_names as $default_block_name) {
// Remove the matching block from the list of blocks in the new theme.
......
......@@ -326,16 +326,14 @@ public function testGetTableOfContents() {
/** @var \Drupal\book\BookManagerInterface $manager */
$manager = $this->container->get('book.manager');
$options = $manager->getTableOfContents($book->id(), 3);
// Verify that all expected option keys are present.
$expected_nids = [$book->id(), $nodes[0]->id(), $nodes[1]->id(), $nodes[2]->id(), $nodes[3]->id(), $nodes[6]->id(), $nodes[4]->id()];
$this->assertEqual(count($options), count($expected_nids));
$diff = array_diff($expected_nids, array_keys($options));
$this->assertTrue(empty($diff), 'Found all expected option keys');
$this->assertEquals($expected_nids, array_keys($options));
// Exclude Node 3.
$options = $manager->getTableOfContents($book->id(), 3, [$nodes[3]->id()]);
// Verify that expected option keys are present after excluding Node 3.
$expected_nids = [$book->id(), $nodes[0]->id(), $nodes[1]->id(), $nodes[2]->id(), $nodes[4]->id()];
$this->assertEqual(count($options), count($expected_nids));
$diff = array_diff($expected_nids, array_keys($options));
$this->assertTrue(empty($diff), 'Found all expected option keys after excluding Node 3');
$this->assertEquals($expected_nids, array_keys($options));
}
/**
......
......@@ -136,7 +136,7 @@ public function testBlockDisplay() {
$this->assertIdenticalResultset($view, $expected_result, $map);
// Check the number of results given by the display is the expected.
$this->assertEqual(count($view->result), $this->blockDisplayResults,
$this->assertCount($this->blockDisplayResults, $view->result,
new FormattableMarkup('There are exactly @results comments. Expected @expected',
['@results' => count($view->result), '@expected' => $this->blockDisplayResults]
)
......
......@@ -101,7 +101,7 @@ public function testContactLink() {
*/
public function assertContactLinks(array $accounts, array $names) {
$result = $this->xpath('//div[contains(@class, "views-field-contact")]//a');
$this->assertEqual(count($result), count($names));
$this->assertSame(count($names), count($result));
foreach ($names as $name) {
$account = $accounts[$name];
......
......@@ -64,7 +64,7 @@ public function checkHooksInvocations($expected_hooks, $actual_hooks) {
$actual_invocations = $actual_hooks[$hook];
// Check that the number of invocations is correct.
$this->assertEqual(count($actual_invocations), count($invocations), "$hook() was called the expected number of times.");
$this->assertSame(count($invocations), count($actual_invocations), "$hook() was called the expected number of times.");
// Check that the hook was called for each expected argument.
foreach ($invocations as $argument) {
......@@ -336,7 +336,7 @@ public function testPurgeField() {
->condition('type', $bundle)
->condition($field_name . '.deleted', 1)
->execute();
$this->assertEqual(count($found), $count, 'Correct number of entities found after purging 2');
$this->assertCount($count, $found, 'Correct number of entities found after purging 2');
}
// Check hooks invocations.
......
......@@ -52,7 +52,7 @@ public function testFieldAttachSaveLoad() {
$entity = $storage->load($entity_id);
// Confirm current revision loads the correct data.
// Number of values per field loaded equals the field cardinality.
$this->assertEqual(count($entity->{$this->fieldTestData->field_name}), $cardinality, 'Current revision: expected number of values');
$this->assertCount($cardinality, $entity->{$this->fieldTestData->field_name}, 'Current revision: expected number of values');
for ($delta = 0; $delta < $cardinality; $delta++) {
// The field value loaded matches the one inserted or updated.
$this->assertEqual($entity->{$this->fieldTestData->field_name}[$delta]->value, $values[$current_revision][$delta]['value'], new FormattableMarkup('Current revision: expected value %delta was found.', ['%delta' => $delta]));
......@@ -62,7 +62,7 @@ public function testFieldAttachSaveLoad() {
foreach (array_keys($values) as $revision_id) {
$entity = $storage->loadRevision($revision_id);
// Number of values per field loaded equals the field cardinality.
$this->assertEqual(count($entity->{$this->fieldTestData->field_name}), $cardinality, new FormattableMarkup('Revision %revision_id: expected number of values.', ['%revision_id' => $revision_id]));
$this->assertCount($cardinality, $entity->{$this->fieldTestData->field_name}, new FormattableMarkup('Revision %revision_id: expected number of values.', ['%revision_id' => $revision_id]));
for ($delta = 0; $delta < $cardinality; $delta++) {
// The field value loaded matches the one inserted or updated.
$this->assertEqual($entity->{$this->fieldTestData->field_name}[$delta]->value, $values[$revision_id][$delta]['value'], new FormattableMarkup('Revision %revision_id: expected value %delta was found.', ['%revision_id' => $revision_id, '%delta' => $delta]));
......@@ -256,7 +256,7 @@ public function testFieldAttachDelete() {
// Confirm each revision loads
foreach ($vids as $vid) {
$revision = $controller->loadRevision($vid);
$this->assertEqual(count($revision->{$this->fieldTestData->field_name}), $cardinality, "The test entity revision $vid has $cardinality values.");
$this->assertCount($cardinality, $revision->{$this->fieldTestData->field_name}, "The test entity revision $vid has $cardinality values.");
}
// Delete revision 1, confirm the other two still load.
......@@ -265,13 +265,13 @@ public function testFieldAttachDelete() {
foreach ([0, 2] as $key) {
$vid = $vids[$key];
$revision = $controller->loadRevision($vid);
$this->assertEqual(count($revision->{$this->fieldTestData->field_name}), $cardinality, "The test entity revision $vid has $cardinality values.");
$this->assertCount($cardinality, $revision->{$this->fieldTestData->field_name}, "The test entity revision $vid has $cardinality values.");
}
// Confirm the current revision still loads
$controller->resetCache();
$current = $controller->load($entity->id());
$this->assertEqual(count($current->{$this->fieldTestData->field_name}), $cardinality, "The test entity current revision has $cardinality values.");
$this->assertCount($cardinality, $current->{$this->fieldTestData->field_name}, "The test entity current revision has $cardinality values.");
// Delete all field data, confirm nothing loads
$entity->delete();
......@@ -308,7 +308,7 @@ public function testEntityCreateBundle() {
// Verify the field data is present on load.
$entity = $this->entitySaveReload($entity);
$this->assertEqual(count($entity->{$this->fieldTestData->field_name}), $cardinality, "Data is retrieved for the new bundle");
$this->assertCount($cardinality, $entity->{$this->fieldTestData->field_name}, "Data is retrieved for the new bundle");
}
/**
......
......@@ -139,7 +139,7 @@ public function testEntityCountAndHasData() {
$storage = $this->container->get('entity_type.manager')->getStorage($entity_type);
$entity = $storage->loadRevision($first_revision);
$this->assertEqual(count($entity->{$this->fieldTestData->field_name_2}), $cardinality, new FormattableMarkup('Revision %revision_id: expected number of values.', ['%revision_id' => $first_revision]));
$this->assertCount($cardinality, $entity->{$this->fieldTestData->field_name_2}, new FormattableMarkup('Revision %revision_id: expected number of values.', ['%revision_id' => $first_revision]));
}
/**
......
......@@ -194,6 +194,8 @@ protected function _generateTestFieldValues($cardinality) {
* (Optional) The name of the column to check. Defaults to 'value'.
*/
protected function assertFieldValues(EntityInterface $entity, $field_name, $expected_values, $langcode = LanguageInterface::LANGCODE_NOT_SPECIFIED, $column = 'value') {
$expected_values_count = count($expected_values);
// Re-load the entity to make sure we have the latest changes.
$storage = $this->container->get('entity_type.manager')
->getStorage($entity->getEntityTypeId());
......@@ -204,7 +206,7 @@ protected function assertFieldValues(EntityInterface $entity, $field_name, $expe
// Filter out empty values so that they don't mess with the assertions.
$field->filterEmptyItems();
$values = $field->getValue();
$this->assertEqual(count($values), count($expected_values), 'Expected number of values were saved.');
$this->assertCount($expected_values_count, $values, 'Expected number of values were saved.');
foreach ($expected_values as $key => $value) {
$this->assertEqual($values[$key][$column], $value, new FormattableMarkup('Value @value was saved correctly.', ['@value' => $value]));
}
......
......@@ -361,7 +361,7 @@ public function testDeleteNoData() {
$entity = $this->entitySaveReload($entity);
// Verify the field is present on load
$this->assertIdentical(count($entity->{$field_storage->getName()}), count($values), "Data in previously deleted field saves and loads correctly");
$this->assertCount(1, $entity->{$field_storage->getName()}, "Data in previously deleted field saves and loads correctly");
foreach ($values as $delta => $value) {
$this->assertEqual($entity->{$field_storage->getName()}[$delta]->value, $values[$delta]['value'], "Data in previously deleted field saves and loads correctly");
}
......@@ -452,7 +452,7 @@ public function testUpdate() {
}
// Load back and assert there are $cardinality number of values.
$entity = $this->entitySaveReload($entity);
$this->assertEqual(count($entity->field_update), $field_storage->getCardinality());
$this->assertCount($field_storage->getCardinality(), $entity->field_update);
// Now check the values themselves.
for ($delta = 0; $delta < $cardinality; $delta++) {
$this->assertEqual($entity->field_update[$delta]->value, $delta + 1);
......
......@@ -221,24 +221,24 @@ public function testMultiValuedWidget() {
$client->request($form->getMethod(), $form->getUri(), $form->getPhpValues(), $edit);
$node = $node_storage->loadUnchanged($nid);
$this->assertEqual(count($node->{$field_name}), $cardinality, 'More files than allowed could not be saved to node.');
$this->assertCount($cardinality, $node->{$field_name}, 'More files than allowed could not be saved to node.');
$upload_files_node_creation = [$test_file, $test_file];
// Try to upload multiple files, but fewer than the maximum.
$nid = $this->uploadNodeFiles($upload_files_node_creation, $field_name, $type_name, TRUE, []);
$node = $node_storage->loadUnchanged($nid);
$this->assertEqual(count($node->{$field_name}), count($upload_files_node_creation), 'Node was successfully saved with multiple files.');
$this->assertSame(count($upload_files_node_creation), count($node->{$field_name}), 'Node was successfully saved with multiple files.');
// Try to upload exactly the allowed number of files on revision.
$this->uploadNodeFile($test_file, $field_name, $node->id(), 1, [], TRUE);
$node = $node_storage->loadUnchanged($nid);
$this->assertEqual(count($node->{$field_name}), $cardinality, 'Node was successfully revised to maximum number of files.');
$this->assertCount($cardinality, $node->{$field_name}, 'Node was successfully revised to maximum number of files.');
// Try to upload exactly the allowed number of files, new node.
$upload_files = [$test_file, $test_file, $test_file];
$nid = $this->uploadNodeFiles($upload_files, $field_name, $type_name, TRUE, []);
$node = $node_storage->loadUnchanged($nid);
$this->assertEqual(count($node->{$field_name}), $cardinality, 'Node was successfully saved with maximum number of files.');
$this->assertCount($cardinality, $node->{$field_name}, 'Node was successfully saved with maximum number of files.');
}
/**
......
......@@ -58,7 +58,7 @@ protected function assertEntity($id, $label, array $expected_effect_plugins, arr
// Check the number of effects associated with the style.
$effects = $style->getEffects();
$this->assertIdentical(count($effects), count($expected_effect_plugins));
$this->assertSame(count($expected_effect_plugins), count($effects));
$index = 0;
foreach ($effects as $effect) {
......
......@@ -64,6 +64,7 @@ public function testBlockFilter() {
// Get all blocks, for assertions later.
$blocks = $page->findAll('css', '.js-layout-builder-block-link');
$blocks_count = count($blocks);
$categories = $page->findAll('css', '.js-layout-builder-category');
$filter = $assert_session->elementExists('css', '.js-layout-builder-filter');
......@@ -75,7 +76,7 @@ public function testBlockFilter() {
$filter->setValue('a');
$this->assertAnnounceContains($init_message);
$visible_rows = $this->filterVisibleElements($blocks);
$this->assertEquals(count($blocks), count($visible_rows));
$this->assertCount($blocks_count, $visible_rows);
// Get the Content Fields category, which will be closed before filtering.
$contentFieldsCategory = $page->find('named', ['content', 'Content fields']);
......
......@@ -107,7 +107,7 @@ public function testFileParsing() {
$this->assertTrue(isset($source_strings[$str]) && $source_strings[$str] === $context, $message);
}
$this->assertEqual(count($source_strings), count($test_strings), 'Found correct number of source strings.');
$this->assertSame(count($test_strings), count($source_strings), 'Found correct number of source strings.');
}
}
......
......@@ -58,7 +58,7 @@ public function testEmbeddedData() {
$this->assertIdentical($results, $data_rows);
// Validate the public APIs.
$this->assertIdentical($source->count(), count($data_rows));
$this->assertSame(count($data_rows), $source->count());
$this->assertIdentical($source->getIds(), $ids);
$expected_fields = [
'key' => 'key',
......
......@@ -404,7 +404,7 @@ public function testProcessRow() {
foreach ($expected as $key => $value) {
$this->assertSame($row->getDestinationProperty($key), $value);
}
$this->assertSame(count($row->getDestination()), count($expected));
$this->assertSame(count($expected), count($row->getDestination()));
}
/**
......
......@@ -98,7 +98,7 @@ public function testMigrationState() {
foreach ($this->stateFileRequired as $module) {
$this->assertArrayHasKey($module, $has_state_file, sprintf("Module '%s' should have a migrate_drupal.yml file", $module));
}
$this->assertEquals(count($this->stateFileRequired), count($has_state_file));
$this->assertSame(count($this->stateFileRequired), count($has_state_file));
}
}
......@@ -129,7 +129,7 @@ public function checkRecords($count, $langcode = 'hu') {
->condition('na.gid', 8888, '=');
$records = $select->execute()->fetchAll();
// Check that the expected record count is returned.
$this->assertEquals(count($records), $count);
$this->assertCount($count, $records);
// The fallback value is 'hu' and should be set to 1. For other languages,
// it should be set to 0. Casting to boolean lets us run that comparison.
foreach ($records as $record) {
......
......@@ -143,7 +143,7 @@ public function testNodeEdit() {
$this->assertRaw('<details class="node-form-author js-form-wrapper form-wrapper" data-drupal-selector="edit-author" id="edit-author" open="open">');
// Only one extra details element should now be open.
$open_details_elements++;
$this->assertEqual(count($this->cssSelect('details[open="open"]')), $open_details_elements, 'Exactly one extra open &lt;details&gt; element found.');
$this->assertCount($open_details_elements, $this->cssSelect('details[open="open"]'), 'Exactly one extra open &lt;details&gt; element found.');
// Edit the same node, save it and verify it's unpublished after unchecking
// the 'Published' boolean_checkbox and clicking 'Save'.
......
......@@ -445,7 +445,7 @@ protected function doUninstallTest() {
$language_count = count(\Drupal::configFactory()->listAll('language.content_settings.'));
\Drupal::service('module_installer')->uninstall(['content_translation']);
$this->rebuildContainer();
$this->assertEqual($language_count, count(\Drupal::configFactory()->listAll('language.content_settings.')), 'Languages have been fixed rather than deleted during content_translation uninstall.');
$this->assertCount($language_count, \Drupal::configFactory()->listAll('language.content_settings.'), 'Languages have been fixed rather than deleted during content_translation uninstall.');
}
/**
......
......@@ -31,7 +31,8 @@ public function testSelectListDynamic() {
// Display form.
$this->drupalGet('entity_test_rev/manage/' . $this->entity->id() . '/edit');
$options = $this->xpath('//select[@id="edit-test-options"]/option');
$this->assertEqual(count($options), count($this->test) + 1);
$options_expected_count = count($this->test) + 1;
$this->assertCount($options_expected_count, $options);
foreach ($options as $option) {
$value = $option->getValue();
if ($value != '_none') {
......
......@@ -212,7 +212,7 @@ protected function doFrontPageRdfaTests() {
$this->drupalGet(Url::fromRoute('<front>'));
// Ensure that both articles are listed.
// $this->assertEqual(2, count($this->getRdfGraph(Url::fromRoute('<front>'), $this->baseUri)->allOfType('http://schema.org/Article')), 'Two articles found on front page.');
// $this->assertCount(2, $this->getRdfGraph(Url::fromRoute('<front>'), $this->baseUri)->allOfType('http://schema.org/Article'), 'Two articles found on front page.');
$this->assertEqual(2, $this->getElementByRdfTypeCount(Url::fromRoute('<front>'), $this->baseUri, 'http://schema.org/Article'), 'Two articles found on front page.');
// Test interaction count.
......
......@@ -713,7 +713,7 @@ public function testFieldapiField() {
$this->executeView($view);
$result = Json::decode($this->drupalGet('test/serialize/node-field', ['query' => ['_format' => 'json']]));
$this->assertEqual(count($result[2]['body']), $node->body->count(), 'Expected count of values');
$this->assertSame($node->body->count(), count($result[2]['body']), 'Expected count of values');
$this->assertEqual($result[2]['body'], array_map(function ($item) {
return $item['value'];
}, $node->body->getValue()), 'Expected raw body values found.');
......
......@@ -66,7 +66,7 @@ protected function assertEntity($id, $label, $expected_size) {
// Check the number of shortcuts in the set.
$shortcuts = $shortcut_set->getShortcuts();
$this->assertIdentical(count($shortcuts), $expected_size);
$this->assertCount($expected_size, $shortcuts);
}
}
......@@ -118,7 +118,7 @@ protected function _testLanguageSelectElementOptions($id, $options) {
$this->assertEqual($option->getText(), $option_title);
next($options);
}
$this->assertEqual($count, count($options), new FormattableMarkup('The number of languages and the number of options shown by the language element are the same: @languages languages, @number options', ['@languages' => count($options), '@number' => $count]));
$this->assertCount($count, $options, new FormattableMarkup('The number of languages and the number of options shown by the language element are the same: @languages languages, @number options', ['@languages' => count($options), '@number' => $count]));
}
}
......@@ -117,7 +117,7 @@ public function testReferenceablesWithNoLabelKey($match, $match_operator, $limit
$this->assertTrue(empty($referenceables[$this->bundle]));
}
else {
$this->assertSame(count($referenceables[$this->bundle]), $count_limited);
$this->assertCount($count_limited, $referenceables[$this->bundle]);
}
// Test returned items.
......
......@@ -44,8 +44,7 @@ public function testTaxonomyTermMultipleLoad() {
// Load the same terms again by tid.
$terms2 = Term::loadMultiple(array_keys($terms));
$this->assertEqual($count, count($terms2), 'Five terms were loaded by tid.');
$this->assertEqual($terms, $terms2, 'Both arrays contain the same terms.');
$this->assertEquals($terms, $terms2, 'Both arrays contain the same terms.');
// Remove one term from the array, then delete it.
$deleted = array_shift($terms2);
......
......@@ -201,7 +201,7 @@ public function testValidation() {
*/
protected function assertLengthViolation(EntityInterface $entity, $field_name, $length, $count = 1, $expected_index = 0) {
$violations = $entity->validate();
$this->assertEqual(count($violations), $count, "Violation found when $field_name is too long.");
$this->assertCount($count, $violations, "Violation found when $field_name is too long.");
$this->assertEqual($violations[$expected_index]->getPropertyPath(), "$field_name.0.value");
$field_label = $entity->get($field_name)->getFieldDefinition()->getLabel();
$this->assertEqual($violations[$expected_index]->getMessage(), t('%name: may not be longer than @max characters.', ['%name' => $field_label, '@max' => $length]));
......
......@@ -81,7 +81,7 @@ public function testMiniPagerRender() {
$view->setDisplay('page_4');
$this->executeView($view);
$this->assertTrue($view->get_total_rows, 'The query was set to calculate the total number of rows.');
$this->assertEqual(count($this->nodes), $view->total_rows, 'The total row count is equal to the number of nodes.');
$this->assertSame(count($this->nodes), (int) $view->total_rows, 'The total row count is equal to the number of nodes.');
$this->drupalGet('test_mini_pager_total', ['query' => ['page' => 1]]);
$this->assertText('of ' . count($this->nodes), 'The first page shows the total row count.');
......@@ -111,7 +111,7 @@ public function testMiniPagerRender() {
$this->assertNoText('Page 1', 'The current page info shows the only page.');
$this->assertNoText('test ››', 'The next link does not appear on the page.');
$result = $this->xpath('//div[contains(@class, "views-row")]');
$this->assertEqual(count($result), count($this->nodes), 'All rows appear on the page.');
$this->assertSame(count($this->nodes), count($result), 'All rows appear on the page.');
// Remove all items beside 1, so there should be no links shown.
for ($i = 0; $i < 19; $i++) {
......
......@@ -200,7 +200,6 @@ public function testDateOrdering() {
$this->executeView($view);
// Verify the result.
$this->assertEqual(count($this->dataSet()), count($view->result), 'The number of returned rows match.');
$this->assertIdenticalResultset($view, $this->expectedResultSet($granularity, $reverse), [
'views_test_data_name' => 'name',
], new FormattableMarkup('Result is returned correctly when ordering by granularity @granularity, @reverse.', ['@granularity' => $granularity, '@reverse' => $reverse ? 'reverse' : 'forward']));
......
......@@ -75,7 +75,7 @@ public function testRandomOrdering() {
$this->executeView($view);
// Verify the result.
$this->assertEqual(count($this->dataSet()), count($view->result), 'The number of returned rows match.');
$this->assertSame(count($this->dataSet()), count($view->result), 'The number of returned rows match.');
$this->assertIdenticalResultset($view, $this->dataSet(), [
'views_test_data_name' => 'name',
'views_test_data_age' => 'age',
......@@ -84,7 +84,7 @@ public function testRandomOrdering() {
// Execute a random view, we expect the result set to be different.
$view_random = $this->getBasicRandomView();
$this->executeView($view_random);
$this->assertEqual(count($this->dataSet()), count($view_random->result), 'The number of returned rows match.');
$this->assertSame(count($this->dataSet()), count($view_random->result), 'The number of returned rows match.');
$this->assertNotIdenticalResultset($view_random, $view->result, [
'views_test_data_name' => 'views_test_data_name',
'views_test_data_age' => 'views_test_data_name',
......@@ -93,7 +93,7 @@ public function testRandomOrdering() {
// Execute a second random view, we expect the result set to be different again.
$view_random_2 = $this->getBasicRandomView();
$this->executeView($view_random_2);
$this->assertEqual(count($this->dataSet()), count($view_random_2->result), 'The number of returned rows match.');
$this->assertSame(count($this->dataSet()), count($view_random_2->result), 'The number of returned rows match.');
$this->assertNotIdenticalResultset($view_random, $view->result, [
'views_test_data_name' => 'views_test_data_name',
'views_test_data_age' => 'views_test_data_name',
......
......@@ -41,7 +41,7 @@ public function testNumericOrdering() {
$this->executeView($view);
// Verify the result.
$this->assertEqual(count($this->dataSet()), count($view->result), 'The number of returned rows match.');
$this->assertSame(count($this->dataSet()), count($view->result), 'The number of returned rows match.');
$this->assertIdenticalResultset($view, $this->orderResultSet($this->dataSet(), 'age'), [
'views_test_data_name' => 'name',
'views_test_data_age' => 'age',
......@@ -65,7 +65,7 @@ public function testNumericOrdering() {
$this->executeView($view);
// Verify the result.
$this->assertEqual(count($this->dataSet()), count($view->result), 'The number of returned rows match.');
$this->assertSame(count($this->dataSet()), count($view->result), 'The number of returned rows match.');
$this->assertIdenticalResultset($view, $this->orderResultSet($this->dataSet(), 'age', TRUE), [
'views_test_data_name' => 'name',
'views_test_data_age' => 'age',
......@@ -94,7 +94,7 @@ public function testStringOrdering() {
$this->executeView($view);
// Verify the result.
$this->assertEqual(count($this->dataSet()), count($view->result), 'The number of returned rows match.');
$this->assertSame(count($this->dataSet()), count($view->result), 'The number of returned rows match.');
$this->assertIdenticalResultset($view, $this->orderResultSet($this->dataSet(), 'name'), [
'views_test_data_name' => 'name',
'views_test_data_age' => 'age',
......@@ -118,7 +118,7 @@ public function testStringOrdering() {
$this->executeView($view);
// Verify the result.
$this->assertEqual(count($this->dataSet()), count($view->result), 'The number of returned rows match.');
$this->assertSame(count($this->dataSet()), count($view->result), 'The number of returned rows match.');
$this->assertIdenticalResultset($view, $this->orderResultSet($this->dataSet(), 'name', TRUE), [
'views_test_data_name' => 'name',
'views_test_data_age' => 'age',
......
......@@ -449,7 +449,7 @@ public function testValidate() {
$count++;
}
$this->assertEqual(count($view->displayHandlers), $count, 'Error messages from all handlers merged.');
$this->assertCount($count, $view->displayHandlers, 'Error messages from all handlers merged.');
// Test that a deleted display is not included.
$display = &$view->storage->getDisplay('default');
......
......@@ -73,11 +73,12 @@ public function testRearrangeFields() {
foreach ($reversedFields as $delta => $field) {
$fields['fields[' . $field . '][weight]'] = $delta;
}
$fields_count = count($fields);
$this->drupalPostForm('admin/structure/views/nojs/rearrange/' . $view_name . '/default/field', $fields, t('Apply'));
$this->assertFieldOrder($view_name, $reversedFields);
// Checks that there is a remove link for each field.
$this->assertEqual(count($this->cssSelect('a.views-remove-link')), count($fields));
$this->assertCount($fields_count, $this->cssSelect('a.views-remove-link'));
}
}
......@@ -74,7 +74,7 @@ public function testViewsListLimit() {
$this->drupalGet('admin/structure/views');
// Check that all the rows are listed.
$this->assertEqual(count($this->xpath('//tbody/tr[contains(@class,"views-ui-list-enabled")]')), $limit);
$this->assertCount($limit, $this->xpath('//tbody/tr[contains(@class,"views-ui-list-enabled")]'));
}
}
......@@ -914,11 +914,11 @@ protected function assertEntityQuery(array $expected_values, $entity_type_id) {
});
// Check entity query counts.
$result = $storage->getQuery()->count()->execute();
$this->assertEquals(count($expected_default_revisions), $result);
$result = (int) $storage->getQuery()->count()->execute();
$this->assertSame(count($expected_default_revisions), $result);
$result = $storage->getAggregateQuery()->count()->execute();
$this->assertEquals(count($expected_default_revisions), $result);
$result = (int) $storage->getAggregateQuery()->count()->execute();
$this->assertSame(count($expected_default_revisions), $result);