Unverified Commit c689c8ef 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
parent 232cd66d
......@@ -197,11 +197,8 @@ public function updateFeedItems(FeedInterface $feed, $expected_count = NULL) {
$this->clickLink('Update items');
// Ensure we have the right number of items.
$iids = \Drupal::entityQuery('aggregator_item')->condition('fid', $feed->id())->execute();
$feed->items = [];
foreach ($iids as $iid) {
$feed->items[] = $iid;
}
$item_ids = \Drupal::entityQuery('aggregator_item')->condition('fid', $feed->id())->execute();
$feed->items = array_values($item_ids);
if ($expected_count !== NULL) {
$feed->item_count = count($feed->items);
......
......@@ -64,16 +64,16 @@ public function testAtomSample() {
$this->assertText('Atom-Powered Robots Run Amok');
$this->assertLinkByHref('http://example.org/2003/12/13/atom03');
$this->assertText('Some text.');
$iids = \Drupal::entityQuery('aggregator_item')->condition('link', 'http://example.org/2003/12/13/atom03')->execute();
$item = Item::load(array_values($iids)[0]);
$item_ids = \Drupal::entityQuery('aggregator_item')->condition('link', 'http://example.org/2003/12/13/atom03')->execute();
$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.');
// Check for second feed entry.
$this->assertText('We tried to stop them, but we failed.');
$this->assertLinkByHref('http://example.org/2003/12/14/atom03');
$this->assertText('Some other text.');
$iids = \Drupal::entityQuery('aggregator_item')->condition('link', 'http://example.org/2003/12/14/atom03')->execute();
$item = Item::load(array_values($iids)[0]);
$item_ids = \Drupal::entityQuery('aggregator_item')->condition('link', 'http://example.org/2003/12/14/atom03')->execute();
$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.');
}
......
......@@ -54,8 +54,8 @@ public function testUpdateFeedItem() {
$feed = Feed::load(array_values($fids)[0]);
$feed->refreshItems();
$iids = \Drupal::entityQuery('aggregator_item')->condition('fid', $feed->id())->execute();
$before = Item::load(array_values($iids)[0])->getPostedTime();
$item_ids = \Drupal::entityQuery('aggregator_item')->condition('fid', $feed->id())->execute();
$before = Item::load(array_values($item_ids)[0])->getPostedTime();
// Sleep for 3 second.
sleep(3);
......@@ -67,7 +67,7 @@ public function testUpdateFeedItem() {
->save();
$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]));
// Make sure updating items works even after uninstalling a module
......
......@@ -241,9 +241,9 @@ public function providerTestBuildCacheability() {
];
// Multi-level tree.
$multi_level_root_a = MenuLinkMock::create(['id' => 'test.roota', 'route_name' => 'roota', 'title' => 'Root A']);
$multi_level_root_b = MenuLinkMock::create(['id' => 'test.rootb', 'route_name' => 'rootb', 'title' => 'Root B']);
$multi_level_parent_c = MenuLinkMock::create(['id' => 'test.parentc', 'route_name' => 'parentc', 'title' => 'Parent C']);
$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.root_b', 'route_name' => 'root_b', 'title' => 'Root B']);
$multi_level_parent_c = MenuLinkMock::create(['id' => 'test.parent_c', 'route_name' => 'parent_c', 'title' => 'Parent C']);
$tree = [
new MenuLinkTreeElement($multi_level_root_a, TRUE, 0, FALSE, [
new MenuLinkTreeElement($multi_level_parent_c, TRUE, 0, FALSE, [
......@@ -256,13 +256,13 @@ public function providerTestBuildCacheability() {
];
$tree[0]->subtree[0]->subtree[0]->access = $access;
$expected_build = $base_expected_build;
$expected_build['#items']['test.roota'] = $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'] = $get_built_element($tree[0]);
$expected_build['#items']['test.root_a']['below']['test.parent_c'] = $get_built_element($tree[0]->subtree[0]);
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.rootb']['below']['test.example2'] = $get_built_element($tree[1]->subtree[0]);
$expected_build['#items']['test.root_b'] = $get_built_element($tree[1]);
$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());
$data[] = [
'description' => "Multi-level tree; access=$i; link=$j.",
......
......@@ -343,16 +343,16 @@ public function testSorting() {
->getTypePlugin()
->setConfiguration([
'states' => [
'twoa' => [
'label' => 'twoa',
'two_a' => [
'label' => 'two a',
'weight' => 2,
],
'three' => [
'label' => 'three',
'weight' => 3,
],
'twob' => [
'label' => 'twob',
'two_b' => [
'label' => 'two b',
'weight' => 2,
],
'one' => [
......@@ -367,10 +367,10 @@ public function testSorting() {
'to' => 'three',
'weight' => 3,
],
'twoa' => [
'label' => 'twoa',
'from' => ['twoa'],
'to' => 'twoa',
'two_a' => [
'label' => 'two a',
'from' => ['two_a'],
'to' => 'two_a',
'weight' => 2,
],
'one' => [
......@@ -379,10 +379,10 @@ public function testSorting() {
'to' => 'one',
'weight' => 1,
],
'twob' => [
'label' => 'twob',
'from' => ['twob'],
'to' => 'twob',
'two_b' => [
'label' => 'two b',
'from' => ['two_b'],
'to' => 'two_b',
'weight' => 2,
],
],
......@@ -391,12 +391,12 @@ public function testSorting() {
$this->drupalLogin($this->createUser(['administer workflows']));
$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');
foreach ($elements as $key => $element) {
$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');
foreach ($elements as $key => $element) {
$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