Commit 2c0c8c11 authored by alexpott's avatar alexpott

Issue #2757007 by claudiu.cristea, tameeshb, Jo Fitzgerald, Sam152,...

Issue #2757007 by claudiu.cristea, tameeshb, Jo Fitzgerald, Sam152, himanshu-dixit, jibran, klausi, dawehner: Convert all book web tests to BrowserTestBase
parent 97d9a7b2
<?php
namespace Drupal\book\Tests;
namespace Drupal\Tests\book\Functional;
use Drupal\simpletest\WebTestBase;
use Drupal\Tests\BrowserTestBase;
/**
* Create a book, add pages, and test book interface.
*
* @group book
*/
class BookBreadcrumbTest extends WebTestBase {
class BookBreadcrumbTest extends BrowserTestBase {
/**
* Modules to install.
......@@ -148,7 +148,7 @@ public function testBreadcrumbTitleUpdates() {
$links = $this->xpath('//nav[@class="breadcrumb"]/ol/li/a');
$got_breadcrumb = [];
foreach ($links as $link) {
$got_breadcrumb[] = (string) $link;
$got_breadcrumb[] = $link->getText();
}
// Home link and four parent book nodes should be in the breadcrumb.
$this->assertEqual(5, count($got_breadcrumb));
......@@ -162,7 +162,7 @@ public function testBreadcrumbTitleUpdates() {
$links = $this->xpath('//nav[@class="breadcrumb"]/ol/li/a');
$got_breadcrumb = [];
foreach ($links as $link) {
$got_breadcrumb[] = (string) $link;
$got_breadcrumb[] = $link->getText();
}
$this->assertEqual(5, count($got_breadcrumb));
$this->assertEqual($edit['title[0][value]'], end($got_breadcrumb));
......@@ -183,7 +183,7 @@ public function testBreadcrumbAccessUpdates() {
$links = $this->xpath('//nav[@class="breadcrumb"]/ol/li/a');
$got_breadcrumb = [];
foreach ($links as $link) {
$got_breadcrumb[] = (string) $link;
$got_breadcrumb[] = $link->getText();
}
$this->assertEqual(5, count($got_breadcrumb));
$this->assertEqual($edit['title[0][value]'], end($got_breadcrumb));
......@@ -193,7 +193,7 @@ public function testBreadcrumbAccessUpdates() {
$links = $this->xpath('//nav[@class="breadcrumb"]/ol/li/a');
$got_breadcrumb = [];
foreach ($links as $link) {
$got_breadcrumb[] = (string) $link;
$got_breadcrumb[] = $link->getText();
}
$this->assertEqual(4, count($got_breadcrumb));
$this->assertEqual($nodes[2]->getTitle(), end($got_breadcrumb));
......
<?php
namespace Drupal\book\Tests;
namespace Drupal\Tests\book\Functional;
use Drupal\simpletest\WebTestBase;
use Drupal\Tests\BrowserTestBase;
use Drupal\Core\Config\PreExistingConfigException;
/**
......@@ -10,7 +10,7 @@
*
* @group book
*/
class BookInstallTest extends WebTestBase {
class BookInstallTest extends BrowserTestBase {
/**
* Modules to install.
......
<?php
namespace Drupal\book\Tests;
namespace Drupal\Tests\book\Functional;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Entity\EntityInterface;
use Drupal\simpletest\WebTestBase;
use Drupal\Tests\BrowserTestBase;
use Drupal\user\RoleInterface;
/**
......@@ -13,7 +13,7 @@
*
* @group book
*/
class BookTest extends WebTestBase {
class BookTest extends BrowserTestBase {
/**
* Modules to install.
......@@ -296,7 +296,7 @@ public function checkBookNode(EntityInterface $node, $nodes, $previous = FALSE,
$links = $this->xpath('//nav[@class="breadcrumb"]/ol/li/a');
$got_breadcrumb = [];
foreach ($links as $link) {
$got_breadcrumb[] = (string) $link['href'];
$got_breadcrumb[] = $link->getAttribute('href');
}
// Compare expected and got breadcrumbs.
......@@ -690,7 +690,7 @@ public function testAdminBookNodeListing() {
$this->assertText($this->book->label(), 'The book title is displayed on the administrative book listing page.');
$elements = $this->xpath('//table//ul[@class="dropbutton"]/li/a');
$this->assertEqual((string) $elements[0], 'View', 'View link is found from the list.');
$this->assertEqual($elements[0]->getText(), 'View', 'View link is found from the list.');
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment