talks/test-driven-drupal/code/3.txt

42 lines
1,015 B
Plaintext

// tests/src/Functional/BlogPageTest.php
/** @test */
public function it_loads_the_blog_page(): void {
$this->drupalGet('/blog');
$this->assertSession()->statusCodeEquals(200);
}
// end test
// start output
E 1 / 1 (100%)
Time: 00:01.379, Memory: 6.00 MB
There was 1 error:
1) Drupal\Tests\drupalcon\Functional\BlogPageTest::it_loads_the_blog_page
Behat\Mink\Exception\ExpectationException:
Current response status code is 404, but 200 expected.
/app/vendor/behat/mink/src/WebAssert.php:794
/app/vendor/behat/mink/src/WebAssert.php:130
/app/web/modules/custom/drupalcon/tests/src/BlogPageTest.php:16
/app/vendor/phpunit/phpunit/src/Framework/TestResult.php:728
ERRORS!
Tests: 1, Assertions: 2, Errors: 1.
// end output
// start routing
# drupalcon.routing.yml
blog.page:
path: /blog
defaults:
_controller: Drupal\drupalcon\Controller\BlogPageController
_title: Blog
requirements:
_permission: access content
// end routing