Add published nodes test
This commit is contained in:
parent
71e70a56c5
commit
8c3b9438c7
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Drupal\Tests\example\Functional;
|
||||
|
||||
use Drupal\example\Builder\PostBuilder;
|
||||
use Drupal\Tests\BrowserTestBase;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
|
@ -33,4 +34,28 @@ class BlogPageTest extends BrowserTestBase {
|
|||
$assert->pageTextContains('Third post');
|
||||
}
|
||||
|
||||
public function testOnlyPublishedNodesAreShown(): void {
|
||||
PostBuilder::create()
|
||||
->setTitle('Post one')
|
||||
->isPublished()
|
||||
->getPost();
|
||||
|
||||
PostBuilder::create()
|
||||
->setTitle('Post two')
|
||||
->isNotPublished()
|
||||
->getPost();
|
||||
|
||||
PostBuilder::create()
|
||||
->setTitle('Post three')
|
||||
->isPublished()
|
||||
->getPost();
|
||||
|
||||
$this->drupalGet('/blog');
|
||||
|
||||
$assert = $this->assertSession();
|
||||
$assert->pageTextContains('Post one');
|
||||
$assert->pageTextNotContains('Post two');
|
||||
$assert->pageTextContains('Post three');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue