Test the talk count
This commit is contained in:
parent
fa691746f0
commit
eae47a9c87
2 changed files with 14 additions and 1 deletions
web/modules/custom/opdavies_talks
|
@ -4,10 +4,16 @@ declare(strict_types=1);
|
|||
|
||||
namespace Drupal\opdavies_talks\Controller;
|
||||
|
||||
use Drupal\Core\StringTranslation\StringTranslationTrait;
|
||||
|
||||
final class TalksPageController {
|
||||
|
||||
use StringTranslationTrait;
|
||||
|
||||
public function __invoke(): array {
|
||||
return [];
|
||||
$talkCount = 2;
|
||||
|
||||
return ['#markup' => $this->t('<span data-talk-count>:count talks</span>', [':count' => $talkCount])];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,4 +18,11 @@ class TalksPageTest extends BrowserTestBase {
|
|||
$session->statusCodeEquals(Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function test_it_displays_the_talk_count(): void {
|
||||
$this->drupalGet('/talks');
|
||||
|
||||
$session = $this->assertSession();
|
||||
$session->responseContains('<span data-talk-count>2 talks</span>');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue