Permalink
Browse files

Added a test case for page title field.

  • Loading branch information...
pmelab committed Aug 9, 2017
1 parent 12b5e06 commit 38578bb6605e4d01006203231f31ec09917a8c5a
Showing with 41 additions and 0 deletions.
  1. +5 −0 tests/queries/page_title.gql
  2. +36 −0 tests/src/Kernel/PageTitleTest.php
@@ -0,0 +1,5 @@
query ($path: String!) {
route(path: $path) {
pageTitle
}
}
@@ -0,0 +1,36 @@
<?php
namespace Drupal\Tests\graphql_example\Kernel;
use Drupal\Tests\graphql_core\Kernel\GraphQLFileTestBase;
/**
* Test the PageTitle field.
*/
class PageTitleTest extends GraphQLFileTestBase {
/**
* {@inheritdoc}
*/
public static $modules = [
'graphql_example',
];
/**
* Test page title queries.
*/
public function testPageTitle() {
$result = $this->executeQueryFile('page_title.gql', [
'path' => '/user/login',
]);
$this->assertEquals([
'data' => [
'route' => [
'pageTitle' => 'Log in',
],
],
], $result, 'Query returns the correct page title');
}
}

0 comments on commit 38578bb

Please sign in to comment.