Last active
June 22, 2017 00:26
-
-
Save pasankg/f777808dade16a96100d963dbd617729 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Drupal\Tests\bravo_testing\Functional\BravoFunctionalTestBase; | |
/** | |
* Tests for the custom block. | |
*/ | |
class CustomBlockFunctionalTest extends BravoFunctionalTestBase { | |
/** | |
* Data Provider. | |
*/ | |
public function addDataProvider() { | |
return [ | |
'block 1' => ['fc4970c1-ed11-4ea9-adb9-47f40b37aff9', 'Edit Title-1'], | |
'block 2' => ['57eb1eb6-e3f2-4314-963a-cf19afc957d0', 'Edit Title-2'], | |
]; | |
} | |
/** | |
* Test for custom blocks. | |
* | |
* @param string $uuid | |
* For block uuid. | |
* @param string $title | |
* For title of the block. | |
* | |
* @dataProvider addDataProvider | |
*/ | |
public function testBlockContent($uuid, $title) { | |
$entityRepository = $this->container->get('entity.repository'); | |
$block = $entityRepository->loadEntityByUuid('block_content', $uuid); | |
$this->drupalGet('<front>'); | |
$page = $this->getSession()->getPage(); | |
$this->assertTrue($page->hasContent($block->label()), 'Title mismatch -1 ' . $page->hasContent($block->label())); | |
$block->setInfo($title); | |
$block->save(); | |
$this->drupalGet('<front>'); | |
$page = $this->getSession()->getPage(); | |
$this->assertTrue($page->hasContent($title), 'Title mismatch -2 ' . $block->label() . ' ' . $title); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
if the content before the first test are different the test fails and gives
Title mismatch -2 Edit Title-1 Edit Title-1
Failed asserting that false is true.
But if I run the test again, it passes