Test Drupal pages

This commit is contained in:
Oliver Davies 2023-12-26 01:35:56 +00:00
parent 11391c2b86
commit 44adee585b

View file

@ -3,13 +3,24 @@
namespace Drupal\Tests\example\Functional; namespace Drupal\Tests\example\Functional;
use Drupal\Tests\BrowserTestBase; use Drupal\Tests\BrowserTestBase;
use Symfony\Component\HttpFoundation\Response;
class ExampleTest extends BrowserTestBase { class ExampleTest extends BrowserTestBase {
protected $defaultTheme = 'stark'; protected $defaultTheme = 'stark';
public function testBasic(): void { public function testFrontPage(): void {
self::assertTrue(TRUE); $this->drupalGet('/');
$assert = $this->assertSession();
$assert->statusCodeEquals(Response::HTTP_OK);
}
public function testAdminPage(): void {
$this->drupalGet('/admin');
$assert = $this->assertSession();
$assert->statusCodeEquals(Response::HTTP_FORBIDDEN);
} }
} }