assertIds example

public function testUserSource(array $configuration) {
    $migration = $this->migrationPluginManager
      ->createStubMigration($this->migrationDefinition('content_entity:user', $configuration));
    $user_source = $migration->getSourcePlugin();
    $this->assertSame('users', $user_source->__toString());
    if (!$configuration['include_translations']) {
      // Confirm that the anonymous user is in the source database but not       // included in the rows returned by the content_entity.       $this->assertNotNull(User::load(0));
      $this->assertEquals(1, $user_source->count());
    }
    $this->assertIds($user_source$configuration);
    $fields = $user_source->fields();
    $this->assertArrayHasKey('name', $fields);
    $this->assertArrayHasKey('pass', $fields);
    $this->assertArrayHasKey('mail', $fields);
    $this->assertArrayHasKey('uid', $fields);
    $this->assertArrayHasKey('roles', $fields);
    $user_source->rewind();
    $values = $user_source->current()->getSource();
    $this->assertEquals('example@example.com', $values['mail'][0]['value']);
    $this->assertEquals('user123', $values['name'][0]['value']);
    $this->assertEquals(1, $values['uid']);
    
        $block_content = $this->createBlockContent(['type' => $type->id()]);
        $block_contents[$type->id()][$block_content->id()] = $block_content;
        $all_ids[] = $block_content->id();
      }
    }

    $this->drupalGet('test-block_content-view');
    $this->assertSession()->statusCodeEquals(404);

    $this->drupalGet('test-block_content-view/all');
    $this->assertSession()->statusCodeEquals(200);
    $this->assertIds($all_ids);
    /** @var \Drupal\block_content\Entity\BlockContentType[] $types*/
    foreach ($types as $type) {
      $this->drupalGet("test-block_content-view/{$type->id()}");
      $this->assertIds(array_keys($block_contents[$type->id()]));
    }
  }

  /** * Ensures that a list of block_contents appear on the page. * * @param array $expected_ids * An array of block_content IDs. * * @internal */

    $contexts = [
      'languages:language_interface',
      'entity_test_view_grants',
      'theme',
      'url.query_args',
      'languages:language_content',
    ];

    $this->drupalGet('test_exposed_form_sort_items_per_page');
    $this->assertCacheContexts($contexts);
    $this->assertIds(range(1, 10, 1));

    $this->drupalGet('test_exposed_form_sort_items_per_page', ['query' => ['sort_order' => 'DESC']]);
    $this->assertCacheContexts($contexts);
    $this->assertIds(range(50, 41, 1));

    $this->drupalGet('test_exposed_form_sort_items_per_page', ['query' => ['sort_order' => 'DESC', 'items_per_page' => 25]]);
    $this->assertCacheContexts($contexts);
    $this->assertIds(range(50, 26, 1));

    $this->drupalGet('test_exposed_form_sort_items_per_page', ['query' => ['sort_order' => 'DESC', 'items_per_page' => 25, 'offset' => 10]]);
    $this->assertCacheContexts($contexts);
    
$this->drupalGet('admin/structure/views/view/test_filter_datetime/edit');
    $this->submitForm([], 'Add Page');
    $this->drupalGet('admin/structure/views/nojs/display/test_filter_datetime/page_1/path');
    $this->submitForm(['path' => $path], 'Apply');
    $this->submitForm([], 'Save');

    $this->drupalGet($path);

    // Filter the Preview by 'empty'.     $this->getSession()->getPage()->findField($this->fieldName . '_value')->selectOption(1);
    $this->getSession()->getPage()->pressButton('Apply');
    $this->assertIds([4]);

    // Filter the Preview by 'not empty'.     $this->getSession()->getPage()->findField($this->fieldName . '_value')->selectOption(2);
    $this->getSession()->getPage()->pressButton('Apply');
    $this->assertIds([1, 2, 3]);

    // Filter the Preview by 'less than'.     $this->getSession()->getPage()->findField($this->fieldName . '_value')->selectOption(3);
    $this->getSession()->getPage()->pressButton('Apply');
    $this->assertIds([2, 3]);

    
Home | Imprint | This part of the site doesn't use cookies.