diff --git a/app/Foundation/Providers/AppServiceProvider.php b/app/Foundation/Providers/AppServiceProvider.php index 3565247b..48f041db 100644 --- a/app/Foundation/Providers/AppServiceProvider.php +++ b/app/Foundation/Providers/AppServiceProvider.php @@ -33,6 +33,8 @@ class AppServiceProvider extends ServiceProvider * Boot the service provider. * * @param \AltThree\Bus\Dispatcher $dispatcher + * + * @return void */ public function boot(Dispatcher $dispatcher) { diff --git a/tests/AbstractTestCase.php b/tests/AbstractTestCase.php index 69311594..941fea8f 100644 --- a/tests/AbstractTestCase.php +++ b/tests/AbstractTestCase.php @@ -14,6 +14,7 @@ namespace CachetHQ\Tests\Cachet; use CachetHQ\Cachet\Models\User; use CachetHQ\Cachet\Settings\Cache; use CachetHQ\Cachet\Settings\Repository; +use CachetHQ\Tests\Cachet\CreatesApplicationTrait; use Illuminate\Contracts\Console\Kernel; use Illuminate\Foundation\Testing\TestCase; @@ -21,15 +22,11 @@ use Illuminate\Foundation\Testing\TestCase; * This is the abstract test case class. * * @author Graham Campbell + * @author James Brooks */ abstract class AbstractTestCase extends TestCase { - /** - * The base URL to use while testing the application. - * - * @var string - */ - protected $baseUrl = 'http://localhost'; + use CreatesApplicationTrait; /** * Test actor. @@ -38,20 +35,6 @@ abstract class AbstractTestCase extends TestCase */ protected $user; - /** - * Creates the application. - * - * @return \Illuminate\Foundation\Application - */ - public function createApplication() - { - $app = require __DIR__.'/../bootstrap/app.php'; - - $app->make(Kernel::class)->bootstrap(); - - return $app; - } - /** * Sign in an user if it's the case. * diff --git a/tests/AnalysisTest.php b/tests/AnalysisTest.php index 0f34b170..6dbb0034 100644 --- a/tests/AnalysisTest.php +++ b/tests/AnalysisTest.php @@ -24,6 +24,11 @@ class AnalysisTest extends TestCase { use AnalysisTrait; + /** + * Get the code paths to analyze. + * + * @return string[] + */ protected function getPaths() { return [ diff --git a/tests/CreatesApplicationTrait.php b/tests/CreatesApplicationTrait.php new file mode 100644 index 00000000..3e6c0a63 --- /dev/null +++ b/tests/CreatesApplicationTrait.php @@ -0,0 +1,36 @@ + + */ +trait CreatesApplicationTrait +{ + /** + * Creates the application. + * + * @return \Illuminate\Foundation\Application + */ + public function createApplication() + { + $app = require __DIR__.'/../bootstrap/app.php'; + + $app->make(Kernel::class)->bootstrap(); + + return $app; + } +} diff --git a/tests/Foundation/Providers/EventServiceProviderTest.php b/tests/Foundation/Providers/EventServiceProviderTest.php index bca5fc82..94f02c2c 100644 --- a/tests/Foundation/Providers/EventServiceProviderTest.php +++ b/tests/Foundation/Providers/EventServiceProviderTest.php @@ -13,13 +13,29 @@ namespace CachetHQ\Tests\Cachet\Foundation\Providers; use AltThree\TestBench\EventServiceProviderTrait; use CachetHQ\Tests\Cachet\AbstractTestCase; +use Illuminate\Support\ServiceProvider; +use ReflectionClass; /** * This is the event service provider test class. * * @author Graham Campbell + * @author James Brooks */ class EventServiceProviderTest extends AbstractTestCase { use EventServiceProviderTrait; + + public function testIsAnEventServiceProvider() + { + $class = $this->getServiceProviderClass($this->app); + + $reflection = new ReflectionClass($class); + + $provider = new ReflectionClass(ServiceProvider::class); + + $msg = "Expected class '$class' to be a service provider."; + + $this->assertTrue($reflection->isSubclassOf($provider), $msg); + } }