docs: DrupalCon updates
This commit is contained in:
parent
6cf7d0fee4
commit
675e89e9d1
28 changed files with 1240 additions and 144 deletions
40
test-driven-drupal/code/7.txt
Normal file
40
test-driven-drupal/code/7.txt
Normal file
|
@ -0,0 +1,40 @@
|
|||
// start test
|
||||
/** @test */
|
||||
public function it_loads_the_blog_page(): void {
|
||||
$this->drupalGet('/blog');
|
||||
|
||||
$session = $this->assertSession();
|
||||
$session->statusCodeEquals(200);
|
||||
|
||||
$session->responseContains('<h1>Blog</h1>');
|
||||
$session->pageTextContains('Welcome to my blog!');
|
||||
}
|
||||
// end test
|
||||
|
||||
// start code
|
||||
namespace Drupal\drupalcon\Controller;
|
||||
|
||||
use Drupal\Core\StringTranslation\StringTranslationTrait;
|
||||
|
||||
class BlogPageController {
|
||||
|
||||
use StringTranslationTrait;
|
||||
|
||||
public function __invoke(): array {
|
||||
return [
|
||||
'#markup' => $this->t('Welcome to my blog!'),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
// end code
|
||||
|
||||
// start output
|
||||
. 1 / 1 (100%)
|
||||
|
||||
Time: 00:01.911, Memory: 6.00 MB
|
||||
|
||||
OK (1 test, 3 assertions)
|
||||
// end output
|
||||
|
||||
Task completed in 0m2.124s
|
Loading…
Add table
Add a link
Reference in a new issue