public function MonthDatePluginTest::testMonthDatePlugin in Drupal 8
Same name and namespace in other branches
- 9 core/modules/views/tests/src/Functional/Plugin/MonthDatePluginTest.php \Drupal\Tests\views\Functional\Plugin\MonthDatePluginTest::testMonthDatePlugin()
Tests the Month Date Plugin.
File
- core/
modules/ views/ tests/ src/ Functional/ Plugin/ MonthDatePluginTest.php, line 66
Class
- MonthDatePluginTest
- Tests the Month Date Plugin.
Namespace
Drupal\Tests\views\Functional\PluginCode
public function testMonthDatePlugin() {
$assert_session = $this
->assertSession();
// Test fallback value.
$this
->drupalGet('test-month-date-plugin');
$assert_session
->statusCodeEquals(200);
$assert_session
->pageTextContains($this->node1
->getTitle());
$assert_session
->pageTextContains($this->node2
->getTitle());
// Test 'all' values.
$this
->drupalGet('test-month-date-plugin/all');
$assert_session
->statusCodeEquals(200);
$assert_session
->pageTextContains($this->node1
->getTitle());
$assert_session
->pageTextContains($this->node2
->getTitle());
// Test valid month value.
$this
->drupalGet('test-month-date-plugin/10');
$assert_session
->statusCodeEquals(200);
$assert_session
->pageTextContains($this->node1
->getTitle());
$assert_session
->pageTextNotContains($this->node2
->getTitle());
// Test query parameter.
$url = Url::fromUserInput('/test-month-date-plugin', [
'query' => [
'month' => 10,
],
]);
$this
->drupalGet($url);
$assert_session
->statusCodeEquals(200);
$assert_session
->pageTextContains($this->node1
->getTitle());
$assert_session
->pageTextNotContains($this->node2
->getTitle());
// Test invalid month name.
$this
->drupalGet('test-month-date-plugin/invalid-month');
$assert_session
->statusCodeEquals(200);
$assert_session
->pageTextNotContains($this->node1
->getTitle());
$assert_session
->pageTextNotContains($this->node2
->getTitle());
}