diff --git a/phpunit_example/lib/Drupal/phpunit_example/Tests/PHPUnitExampleMenuTest.php b/phpunit_example/lib/Drupal/phpunit_example/Tests/PHPUnitExampleMenuTest.php index 4e03f0a..d8dabb8 100644 --- a/phpunit_example/lib/Drupal/phpunit_example/Tests/PHPUnitExampleMenuTest.php +++ b/phpunit_example/lib/Drupal/phpunit_example/Tests/PHPUnitExampleMenuTest.php @@ -12,6 +12,9 @@ use Drupal\simpletest\WebTestBase; /** * Test the user-facing menus in PHPUnit Example. * + * Note that this is _not_ a PHPUnit-based test. It's a functional + * test of whether this module can be enabled properly. + * * @ingroup phpunit_example */ class PHPUnitExampleMenuTest extends WebTestBase { @@ -26,6 +29,9 @@ class PHPUnitExampleMenuTest extends WebTestBase { /** * The installation profile to use with this test. * + * We need the 'minimal' profile in order to make sure the Tool block is + * available. + * * @var string */ protected $profile = 'minimal'; @@ -42,11 +48,28 @@ class PHPUnitExampleMenuTest extends WebTestBase { } /** - * Test for a link to the phpunit example in the Tools menu. + * Data provider for testing menu links. + * + * @return array + * Array of page -> link relationships to check for. + * The key is the path to the page where our link should appear. + * The value is the link that should appear on that page. + */ + protected function providerMenuLinks() { + return array( + '/' => 'examples/phpunit_example', + ); + } + + /** + * Verify and validate that default menu links were loaded for this module. */ public function testPHPUnitExampleLink() { - $this->drupalGet(''); - $this->assertLinkByHref('examples/phpunit_example'); + $links = $this->providerMenuLinks(); + foreach ($links as $page => $path) { + $this->drupalGet($page); + $this->assertLinkByHref($path); + } } /** diff --git a/phpunit_example/lib/Drupal/phpunit_example/Tests/PHPUnitExampleSimpleTest.php b/phpunit_example/lib/Drupal/phpunit_example/Tests/PHPUnitExampleSimpleTest.php deleted file mode 100644 index 6c5fc29..0000000 --- a/phpunit_example/lib/Drupal/phpunit_example/Tests/PHPUnitExampleSimpleTest.php +++ /dev/null @@ -1,46 +0,0 @@ - 'PHPUnit Example Tests', - 'description' => 'Functional tests for the PHPUnit Example module', - 'group' => 'Examples', - ); - } - - /** - * Very simple regression test for PHPUnit Example module. - * - * All we do is enable PHPUnit Example and see if it can successfully - * return its main page. - */ - public function testController() { - $this->drupalGet('examples/phpunit_example'); - $this->assertResponse(200, 'The PHPUnit Example description page is available.'); - } - -}