Unverified Commit d4a43eb3 authored by alexpott's avatar alexpott

Issue #3160020 by jungle, ravi.shankar, alexpott, ultrabob: Fix typos "iids,...

Issue #3160020 by jungle, ravi.shankar, alexpott, ultrabob: Fix typos "iids, twoa, twob, roota, rootb, parentc" by refactoring

(cherry picked from commit c689c8ef)
parent 039c9c63
...@@ -197,11 +197,8 @@ public function updateFeedItems(FeedInterface $feed, $expected_count = NULL) { ...@@ -197,11 +197,8 @@ public function updateFeedItems(FeedInterface $feed, $expected_count = NULL) {
$this->clickLink('Update items'); $this->clickLink('Update items');
// Ensure we have the right number of items. // Ensure we have the right number of items.
$iids = \Drupal::entityQuery('aggregator_item')->condition('fid', $feed->id())->execute(); $item_ids = \Drupal::entityQuery('aggregator_item')->condition('fid', $feed->id())->execute();
$feed->items = []; $feed->items = array_values($item_ids);
foreach ($iids as $iid) {
$feed->items[] = $iid;
}
if ($expected_count !== NULL) { if ($expected_count !== NULL) {
$feed->item_count = count($feed->items); $feed->item_count = count($feed->items);
......
...@@ -64,16 +64,16 @@ public function testAtomSample() { ...@@ -64,16 +64,16 @@ public function testAtomSample() {
$this->assertText('Atom-Powered Robots Run Amok'); $this->assertText('Atom-Powered Robots Run Amok');
$this->assertLinkByHref('http://example.org/2003/12/13/atom03'); $this->assertLinkByHref('http://example.org/2003/12/13/atom03');
$this->assertText('Some text.'); $this->assertText('Some text.');
$iids = \Drupal::entityQuery('aggregator_item')->condition('link', 'http://example.org/2003/12/13/atom03')->execute(); $item_ids = \Drupal::entityQuery('aggregator_item')->condition('link', 'http://example.org/2003/12/13/atom03')->execute();
$item = Item::load(array_values($iids)[0]); $item = Item::load(array_values($item_ids)[0]);
$this->assertEqual('urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a', $item->getGuid(), 'Atom entry id element is parsed correctly.'); $this->assertEqual('urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a', $item->getGuid(), 'Atom entry id element is parsed correctly.');
// Check for second feed entry. // Check for second feed entry.
$this->assertText('We tried to stop them, but we failed.'); $this->assertText('We tried to stop them, but we failed.');
$this->assertLinkByHref('http://example.org/2003/12/14/atom03'); $this->assertLinkByHref('http://example.org/2003/12/14/atom03');
$this->assertText('Some other text.'); $this->assertText('Some other text.');
$iids = \Drupal::entityQuery('aggregator_item')->condition('link', 'http://example.org/2003/12/14/atom03')->execute(); $item_ids = \Drupal::entityQuery('aggregator_item')->condition('link', 'http://example.org/2003/12/14/atom03')->execute();
$item = Item::load(array_values($iids)[0]); $item = Item::load(array_values($item_ids)[0]);
$this->assertEqual('urn:uuid:1225c695-cfb8-4ebb-bbbb-80da344efa6a', $item->getGuid(), 'Atom entry id element is parsed correctly.'); $this->assertEqual('urn:uuid:1225c695-cfb8-4ebb-bbbb-80da344efa6a', $item->getGuid(), 'Atom entry id element is parsed correctly.');
} }
......
...@@ -54,8 +54,8 @@ public function testUpdateFeedItem() { ...@@ -54,8 +54,8 @@ public function testUpdateFeedItem() {
$feed = Feed::load(array_values($fids)[0]); $feed = Feed::load(array_values($fids)[0]);
$feed->refreshItems(); $feed->refreshItems();
$iids = \Drupal::entityQuery('aggregator_item')->condition('fid', $feed->id())->execute(); $item_ids = \Drupal::entityQuery('aggregator_item')->condition('fid', $feed->id())->execute();
$before = Item::load(array_values($iids)[0])->getPostedTime(); $before = Item::load(array_values($item_ids)[0])->getPostedTime();
// Sleep for 3 second. // Sleep for 3 second.
sleep(3); sleep(3);
...@@ -67,7 +67,7 @@ public function testUpdateFeedItem() { ...@@ -67,7 +67,7 @@ public function testUpdateFeedItem() {
->save(); ->save();
$feed->refreshItems(); $feed->refreshItems();
$after = Item::load(array_values($iids)[0])->getPostedTime(); $after = Item::load(array_values($item_ids)[0])->getPostedTime();
$this->assertTrue($before === $after, new FormattableMarkup('Publish timestamp of feed item was not updated (@before === @after)', ['@before' => $before, '@after' => $after])); $this->assertTrue($before === $after, new FormattableMarkup('Publish timestamp of feed item was not updated (@before === @after)', ['@before' => $before, '@after' => $after]));
// Make sure updating items works even after uninstalling a module // Make sure updating items works even after uninstalling a module
......
...@@ -241,9 +241,9 @@ public function providerTestBuildCacheability() { ...@@ -241,9 +241,9 @@ public function providerTestBuildCacheability() {
]; ];
// Multi-level tree. // Multi-level tree.
$multi_level_root_a = MenuLinkMock::create(['id' => 'test.roota', 'route_name' => 'roota', 'title' => 'Root A']); $multi_level_root_a = MenuLinkMock::create(['id' => 'test.root_a', 'route_name' => 'root_a', 'title' => 'Root A']);
$multi_level_root_b = MenuLinkMock::create(['id' => 'test.rootb', 'route_name' => 'rootb', 'title' => 'Root B']); $multi_level_root_b = MenuLinkMock::create(['id' => 'test.root_b', 'route_name' => 'root_b', 'title' => 'Root B']);
$multi_level_parent_c = MenuLinkMock::create(['id' => 'test.parentc', 'route_name' => 'parentc', 'title' => 'Parent C']); $multi_level_parent_c = MenuLinkMock::create(['id' => 'test.parent_c', 'route_name' => 'parent_c', 'title' => 'Parent C']);
$tree = [ $tree = [
new MenuLinkTreeElement($multi_level_root_a, TRUE, 0, FALSE, [ new MenuLinkTreeElement($multi_level_root_a, TRUE, 0, FALSE, [
new MenuLinkTreeElement($multi_level_parent_c, TRUE, 0, FALSE, [ new MenuLinkTreeElement($multi_level_parent_c, TRUE, 0, FALSE, [
...@@ -256,13 +256,13 @@ public function providerTestBuildCacheability() { ...@@ -256,13 +256,13 @@ public function providerTestBuildCacheability() {
]; ];
$tree[0]->subtree[0]->subtree[0]->access = $access; $tree[0]->subtree[0]->subtree[0]->access = $access;
$expected_build = $base_expected_build; $expected_build = $base_expected_build;
$expected_build['#items']['test.roota'] = $get_built_element($tree[0]); $expected_build['#items']['test.root_a'] = $get_built_element($tree[0]);
$expected_build['#items']['test.roota']['below']['test.parentc'] = $get_built_element($tree[0]->subtree[0]); $expected_build['#items']['test.root_a']['below']['test.parent_c'] = $get_built_element($tree[0]->subtree[0]);
if ($access === NULL || $access->isAllowed()) { if ($access === NULL || $access->isAllowed()) {
$expected_build['#items']['test.roota']['below']['test.parentc']['below']['test.example1'] = $get_built_element($tree[0]->subtree[0]->subtree[0]); $expected_build['#items']['test.root_a']['below']['test.parent_c']['below']['test.example1'] = $get_built_element($tree[0]->subtree[0]->subtree[0]);
} }
$expected_build['#items']['test.rootb'] = $get_built_element($tree[1]); $expected_build['#items']['test.root_b'] = $get_built_element($tree[1]);
$expected_build['#items']['test.rootb']['below']['test.example2'] = $get_built_element($tree[1]->subtree[0]); $expected_build['#items']['test.root_b']['below']['test.example2'] = $get_built_element($tree[1]->subtree[0]);
$expected_build['#cache']['contexts'] = array_merge($expected_build['#cache']['contexts'], $access_cache_contexts, $links[0]->getCacheContexts(), $links[1]->getCacheContexts()); $expected_build['#cache']['contexts'] = array_merge($expected_build['#cache']['contexts'], $access_cache_contexts, $links[0]->getCacheContexts(), $links[1]->getCacheContexts());
$data[] = [ $data[] = [
'description' => "Multi-level tree; access=$i; link=$j.", 'description' => "Multi-level tree; access=$i; link=$j.",
......
...@@ -343,16 +343,16 @@ public function testSorting() { ...@@ -343,16 +343,16 @@ public function testSorting() {
->getTypePlugin() ->getTypePlugin()
->setConfiguration([ ->setConfiguration([
'states' => [ 'states' => [
'twoa' => [ 'two_a' => [
'label' => 'twoa', 'label' => 'two a',
'weight' => 2, 'weight' => 2,
], ],
'three' => [ 'three' => [
'label' => 'three', 'label' => 'three',
'weight' => 3, 'weight' => 3,
], ],
'twob' => [ 'two_b' => [
'label' => 'twob', 'label' => 'two b',
'weight' => 2, 'weight' => 2,
], ],
'one' => [ 'one' => [
...@@ -367,10 +367,10 @@ public function testSorting() { ...@@ -367,10 +367,10 @@ public function testSorting() {
'to' => 'three', 'to' => 'three',
'weight' => 3, 'weight' => 3,
], ],
'twoa' => [ 'two_a' => [
'label' => 'twoa', 'label' => 'two a',
'from' => ['twoa'], 'from' => ['two_a'],
'to' => 'twoa', 'to' => 'two_a',
'weight' => 2, 'weight' => 2,
], ],
'one' => [ 'one' => [
...@@ -379,10 +379,10 @@ public function testSorting() { ...@@ -379,10 +379,10 @@ public function testSorting() {
'to' => 'one', 'to' => 'one',
'weight' => 1, 'weight' => 1,
], ],
'twob' => [ 'two_b' => [
'label' => 'twob', 'label' => 'two b',
'from' => ['twob'], 'from' => ['two_b'],
'to' => 'twob', 'to' => 'two_b',
'weight' => 2, 'weight' => 2,
], ],
], ],
...@@ -391,12 +391,12 @@ public function testSorting() { ...@@ -391,12 +391,12 @@ public function testSorting() {
$this->drupalLogin($this->createUser(['administer workflows'])); $this->drupalLogin($this->createUser(['administer workflows']));
$this->drupalGet('admin/config/workflow/workflows/manage/test'); $this->drupalGet('admin/config/workflow/workflows/manage/test');
$expected_states = ['one', 'twoa', 'twob', 'three']; $expected_states = ['one', 'two a', 'two b', 'three'];
$elements = $this->xpath('//details[@id="edit-states-container"]//table/tbody/tr'); $elements = $this->xpath('//details[@id="edit-states-container"]//table/tbody/tr');
foreach ($elements as $key => $element) { foreach ($elements as $key => $element) {
$this->assertEquals($expected_states[$key], $element->find('xpath', 'td')->getText()); $this->assertEquals($expected_states[$key], $element->find('xpath', 'td')->getText());
} }
$expected_transitions = ['one', 'twoa', 'twob', 'three']; $expected_transitions = ['one', 'two a', 'two b', 'three'];
$elements = $this->xpath('//details[@id="edit-transitions-container"]//table/tbody/tr'); $elements = $this->xpath('//details[@id="edit-transitions-container"]//table/tbody/tr');
foreach ($elements as $key => $element) { foreach ($elements as $key => $element) {
$this->assertEquals($expected_transitions[$key], $element->find('xpath', 'td')->getText()); $this->assertEquals($expected_transitions[$key], $element->find('xpath', 'td')->getText());
......
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