Unverified Commit d4a43eb3 authored by Alex Pott's avatar Alex Pott
Browse files

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
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -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);
+4 −4
Original line number Diff line number Diff line
@@ -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.');
  }

+3 −3
Original line number Diff line number Diff line
@@ -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
+8 −8
Original line number Diff line number Diff line
@@ -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.",
+14 −14
Original line number Diff line number Diff line
@@ -343,7 +343,7 @@ public function testSorting() {
      ->getTypePlugin()
      ->setConfiguration([
        'states' => [
          'twoa' => [
          'two_a' => [
            'label' => 'two a',
            'weight' => 2,
          ],
@@ -351,7 +351,7 @@ public function testSorting() {
            'label' => 'three',
            'weight' => 3,
          ],
          'twob' => [
          'two_b' => [
            'label' => 'two b',
            'weight' => 2,
          ],
@@ -367,10 +367,10 @@ public function testSorting() {
            'to' => 'three',
            'weight' => 3,
          ],
          'twoa' => [
          'two_a' => [
            'label' => 'two a',
            'from' => ['twoa'],
            'to' => 'twoa',
            'from' => ['two_a'],
            'to' => 'two_a',
            'weight' => 2,
          ],
          'one' => [
@@ -379,10 +379,10 @@ public function testSorting() {
            'to' => 'one',
            'weight' => 1,
          ],
          'twob' => [
          'two_b' => [
            'label' => 'two b',
            'from' => ['twob'],
            'to' => 'twob',
            'from' => ['two_b'],
            'to' => 'two_b',
            'weight' => 2,
          ],
        ],