public function QueueBrowserFormTest::testData in Purge 8.3
Tests that data is shown accordingly.
See also
\Drupal\purge_ui\Form\QueueBrowserForm::buildForm
\Drupal\purge_ui\Form\CloseDialogTrait::closeDialog
File
- modules/
purge_ui/ tests/ src/ Functional/ Form/ QueueBrowserFormTest.php, line 88
Class
Namespace
Drupal\Tests\purge_ui\Functional\FormCode
public function testData() : void {
$this
->drupalLogin($this->adminUser);
$this
->initializeInvalidationFactoryService();
$this
->initializePurgersService([
'id' => 'good',
]);
$this
->initializeQueueService('database');
// Add 30 tags to the queue and collect the strings we're adding.
$tags = $needles = [];
for ($i = 1; $i <= 30; $i++) {
$needles[$i] = "node:{$i}";
$tags[] = $this->purgeInvalidationFactory
->get('tag', $needles[$i]);
}
$this->purgeQueue
->add($this->queuer, $tags);
// Assert that the pager works and returns our objects.
$this
->assertEquals(15, count($this->purgeQueue
->selectPage()));
$this
->assertEquals(50, $this->purgeQueue
->selectPageLimit(50));
$this
->assertEquals(30, count($this->purgeQueue
->selectPage()));
$this->purgeQueue
->reload();
// Render the interface and find the first 15 tags, the is on page 2.
$this
->drupalGet($this
->getPath());
$this
->assertSession()
->pageTextContains("Type");
$this
->assertSession()
->pageTextContains("State");
$this
->assertSession()
->pageTextContains("Expression");
$this
->assertSession()
->pageTextContains("New");
$this
->assertActionExists('edit-1', '1');
$this
->assertActionExists('edit-2', '2');
$this
->assertActionNotExists('edit-3', '3');
foreach ($needles as $i => $needle) {
$needle = "<td>{$needle}</td>";
if ($i >= 16) {
$this
->assertSession()
->responseContains($needle);
}
else {
$this
->assertSession()
->responseNotContains($needle);
}
}
}