Commit 968da88d authored by catch's avatar catch

Issue #2928846 by alexpott, Berdir: [PHP 7.2] count() parameter must be an...

Issue #2928846 by alexpott, Berdir: [PHP 7.2] count() parameter must be an array or an object that implements Countable
parent 40856ccd
......@@ -101,8 +101,8 @@ public function attachmentsProvider() {
'random attachment type (unofficial), with random assigned value, to prove BigPipeResponseAttachmentsProcessor is a perfect decorator' => [$random_attachments],
];
$big_pipe_placeholder_attachments = ['big_pipe_placeholders' => $this->randomMachineName()];
$big_pipe_nojs_placeholder_attachments = ['big_pipe_nojs_placeholders' => $this->randomMachineName()];
$big_pipe_placeholder_attachments = ['big_pipe_placeholders' => [$this->randomMachineName()]];
$big_pipe_nojs_placeholder_attachments = ['big_pipe_nojs_placeholders' => [$this->randomMachineName()]];
$big_pipe_cases = [
'only big_pipe_placeholders' => [$big_pipe_placeholder_attachments],
'only big_pipe_nojs_placeholders' => [$big_pipe_nojs_placeholder_attachments],
......
......@@ -77,7 +77,7 @@ public function testMapperListPage() {
// Make sure there is only a single operation for each dropbutton, either
// 'List' or 'Translate'.
foreach ($this->cssSelect('ul.dropbutton') as $i => $dropbutton) {
$this->assertIdentical(1, count($dropbutton->find('xpath', 'li')));
$this->assertIdentical(1, count($dropbutton->findAll('xpath', 'li')));
$this->assertTrue(($dropbutton->getText() === 'Translate') || ($dropbutton->getText() === 'List'));
}
......@@ -103,7 +103,7 @@ public function testMapperListPage() {
// Make sure there is only a single 'Translate' operation for each
// dropbutton.
foreach ($this->cssSelect('ul.dropbutton') as $i => $dropbutton) {
$this->assertIdentical(1, count($dropbutton->find('xpath', 'li')));
$this->assertIdentical(1, count($dropbutton->findAll('xpath', 'li')));
$this->assertIdentical('Translate', $dropbutton->getText());
}
......
......@@ -332,6 +332,12 @@ public function testFieldAdminHandler() {
$this->drupalPostForm(NULL, $edit, t('Save field settings'));
$this->drupalGet($bundle_path . '/fields/' . $field_path);
$term_name = $this->randomString();
$result = \Drupal::entityQuery('taxonomy_term')
->condition('name', $term_name)
->condition('vid', 'tags')
->accessCheck(FALSE)
->execute();
$this->assertIdentical(0, count($result), "No taxonomy terms exist with the name '$term_name'.");
$edit = [
// This must be set before new entities will be auto-created.
'settings[handler_settings][auto_create]' => 1,
......@@ -344,8 +350,12 @@ public function testFieldAdminHandler() {
];
$this->drupalPostForm(NULL, $edit, t('Save settings'));
// The term should now exist.
$term = taxonomy_term_load_multiple_by_name($term_name, 'tags')[1];
$this->assertIdentical(1, count($term), 'Taxonomy term was auto created when set as field default.');
$result = \Drupal::entityQuery('taxonomy_term')
->condition('name', $term_name)
->condition('vid', 'tags')
->accessCheck(FALSE)
->execute();
$this->assertIdentical(1, count($result), 'Taxonomy term was auto created when set as field default.');
}
/**
......
......@@ -50,14 +50,13 @@ public function assertTourTips($tips = []) {
// Check for corresponding page elements.
$total = 0;
$modals = 0;
$raw_content = $this->getSession()->getPage()->getContent();
foreach ($tips as $tip) {
if (!empty($tip['data-id'])) {
$elements = \PHPUnit_Util_XML::cssSelect('#' . $tip['data-id'], TRUE, $raw_content, TRUE);
$elements = $this->getSession()->getPage()->findAll('css', '#' . $tip['data-id']);
$this->assertTrue(!empty($elements) && count($elements) === 1, format_string('Found corresponding page element for tour tip with id #%data-id', ['%data-id' => $tip['data-id']]));
}
elseif (!empty($tip['data-class'])) {
$elements = \PHPUnit_Util_XML::cssSelect('.' . $tip['data-class'], TRUE, $raw_content, TRUE);
$elements = $this->getSession()->getPage()->findAll('css', '.' . $tip['data-class']);
$this->assertFalse(empty($elements), format_string('Found corresponding page element for tour tip with class .%data-class', ['%data-class' => $tip['data-class']]));
}
else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment