public function BlockContentIntegrationTest::testBlockContentViewTypeArgument in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/block_content/src/Tests/Views/BlockContentIntegrationTest.php \Drupal\block_content\Tests\Views\BlockContentIntegrationTest::testBlockContentViewTypeArgument()
Tests basic block_content view with a block_content_type argument.
File
- core/
modules/ block_content/ src/ Tests/ Views/ BlockContentIntegrationTest.php, line 27 - Contains \Drupal\block_content\Tests\Views\BlockContentIntegrationTest.
Class
- BlockContentIntegrationTest
- Tests the block_content integration into views.
Namespace
Drupal\block_content\Tests\ViewsCode
public function testBlockContentViewTypeArgument() {
// Create two content types with three block_contents each.
$types = array();
$all_ids = array();
$block_contents = array();
for ($i = 0; $i < 2; $i++) {
$type = $this
->createBlockContentType();
$types[] = $type;
for ($j = 0; $j < 5; $j++) {
// Ensure the right order of the block_contents.
$block_content = $this
->createBlockContent(array(
'type' => $type
->id(),
));
$block_contents[$type
->id()][$block_content
->id()] = $block_content;
$all_ids[] = $block_content
->id();
}
}
$this
->drupalGet('test-block_content-view');
$this
->assertResponse(404);
$this
->drupalGet('test-block_content-view/all');
$this
->assertResponse(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()]));
}
}