FlippyTest.php in Flippy 8
File
tests/src/Functional/FlippyTest.php
View source
<?php
namespace Drupal\Tests\flippy\Functional;
use Drupal\Tests\BrowserTestBase;
class FlippyTest extends BrowserTestBase {
public static $modules = [
'node',
'flippy',
];
public $strictConfigSchema = FALSE;
public function setUp() {
parent::setUp();
$type = $this->container
->get('entity_type.manager')
->getStorage('node_type')
->create([
'type' => 'article',
'name' => 'Article',
]);
$type
->save();
$this->container
->get('router.builder')
->rebuild();
\Drupal::configFactory()
->getEditable('flippy.settings')
->set('flippy_article', 1)
->set('flippy_prev_label_article', 'Previous')
->set('flippy_next_label_article', 'Next')
->set('flippy_first_label_article', 'First')
->set('flippy_last_label_article', 'Last')
->set('flippy_random_label_article', 'Random')
->save();
for ($i = 0; $i <= 2; $i++) {
$node = $this->container
->get('entity_type.manager')
->getStorage('node')
->create([
'type' => 'article',
'title' => $i,
]);
$node
->save();
}
}
public function testPagerOnPage() {
$this
->drupalGet('/node/1');
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertNoText('Previous');
$this
->assertText('Next');
$this
->drupalGet('/node/2');
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertText('Previous');
$this
->assertText('Next');
$this
->drupalGet('/node/3');
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertText('Previous');
$this
->assertNoText('Next');
}
}
Classes
Name |
Description |
FlippyTest |
Tests that the Flippy pagers are appearing. |