diff --git a/tests/Api/AbstractApiTestCase.php b/tests/Api/AbstractApiTestCase.php index 84fee02d..7299a769 100644 --- a/tests/Api/AbstractApiTestCase.php +++ b/tests/Api/AbstractApiTestCase.php @@ -14,18 +14,22 @@ namespace CachetHQ\Tests\Cachet\Api; use CachetHQ\Cachet\Models\User; use CachetHQ\Tests\Cachet\AbstractTestCase; use Illuminate\Foundation\Testing\DatabaseMigrations; +use Laravel\BrowserKitTesting\Concerns\MakesHttpRequests; /** * This is the abstract api test case class. * * @author Graham Campbell + * @author James Brooks */ abstract class AbstractApiTestCase extends AbstractTestCase { - use DatabaseMigrations; + use MakesHttpRequests, DatabaseMigrations; /** * Become a user. + * + * @return void */ protected function beUser() { diff --git a/tests/Http/Controllers/Dashboard/DashboardControllerTest.php b/tests/Http/Controllers/Dashboard/DashboardControllerTest.php deleted file mode 100644 index d05096c6..00000000 --- a/tests/Http/Controllers/Dashboard/DashboardControllerTest.php +++ /dev/null @@ -1,84 +0,0 @@ -setupPublicAndNonPublicComponentGroups() - ->setupConfig(); - } - - /** @test */ - public function on_dashboard_all_component_groups_are_displayed() - { - $this->signIn(); - - $this->visit('/dashboard') - ->see(self::COMPONENT_GROUP_1_NAME) - ->see(self::COMPONENT_GROUP_2_NAME); - } - - /** - * Set up the needed data for the components groups tests. - * - * @return TestCase - */ - protected function setupPublicAndNonPublicComponentGroups() - { - $this->createAComponentGroupAndAddAComponent(self::COMPONENT_GROUP_1_NAME, ComponentGroup::VISIBLE_GUEST) - ->createAComponentGroupAndAddAComponent(self::COMPONENT_GROUP_2_NAME, ComponentGroup::VISIBLE_AUTHENTICATED); - - factory(Setting::class)->create(); - - return $this; - } - - /** - * Create a component group and add one component to it. - * - * @param string $name - * @param string $visible - * - * @return TestCase - */ - protected function createAComponentGroupAndAddAComponent($name, $visible) - { - factory(ComponentGroup::class) - ->create(['name' => $name, 'visible' => $visible]) - ->components() - ->save(factory(Component::class)->create()); - - return $this; - } -} diff --git a/tests/Http/Controllers/StatusPageControllerTest.php b/tests/Http/Controllers/StatusPageControllerTest.php deleted file mode 100644 index 41204776..00000000 --- a/tests/Http/Controllers/StatusPageControllerTest.php +++ /dev/null @@ -1,89 +0,0 @@ -setupPublicAndNonPublicComponentGroups() - ->setupConfig(); - } - - public function testIndexShowsOnlyPublicComponentGroupsToGuests() - { - $this->visit('/') - ->see(self::COMPONENT_GROUP_1_NAME) - ->dontSee(self::COMPONENT_GROUP_2_NAME); - } - - public function testIndexShowsAllComponentGroupsToLoggedInUsers() - { - $this->signIn(); - - $this->visit('/') - ->see(self::COMPONENT_GROUP_1_NAME) - ->see(self::COMPONENT_GROUP_2_NAME); - } - - /** - * Set up the needed data for the components groups tests. - * - * @return AbstractTestCase - */ - protected function setupPublicAndNonPublicComponentGroups() - { - $this->createAComponentGroupAndAddAComponent(self::COMPONENT_GROUP_1_NAME, ComponentGroup::VISIBLE_GUEST) - ->createAComponentGroupAndAddAComponent(self::COMPONENT_GROUP_2_NAME, ComponentGroup::VISIBLE_AUTHENTICATED); - - factory(Setting::class)->create(); - - return $this; - } - - /** - * Create a component group and add one component to it. - * - * @param string $name - * @param string $visible - * - * @return AbstractTestCase - */ - protected function createAComponentGroupAndAddAComponent($name, $visible) - { - factory(ComponentGroup::class) - ->create(['name' => $name, 'visible' => $visible]) - ->components() - ->save(factory(Component::class)->create()); - - return $this; - } -}