Update tests a little
This commit is contained in:
@@ -33,6 +33,8 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
* Boot the service provider.
|
* Boot the service provider.
|
||||||
*
|
*
|
||||||
* @param \AltThree\Bus\Dispatcher $dispatcher
|
* @param \AltThree\Bus\Dispatcher $dispatcher
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function boot(Dispatcher $dispatcher)
|
public function boot(Dispatcher $dispatcher)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ namespace CachetHQ\Tests\Cachet;
|
|||||||
use CachetHQ\Cachet\Models\User;
|
use CachetHQ\Cachet\Models\User;
|
||||||
use CachetHQ\Cachet\Settings\Cache;
|
use CachetHQ\Cachet\Settings\Cache;
|
||||||
use CachetHQ\Cachet\Settings\Repository;
|
use CachetHQ\Cachet\Settings\Repository;
|
||||||
|
use CachetHQ\Tests\Cachet\CreatesApplicationTrait;
|
||||||
use Illuminate\Contracts\Console\Kernel;
|
use Illuminate\Contracts\Console\Kernel;
|
||||||
use Illuminate\Foundation\Testing\TestCase;
|
use Illuminate\Foundation\Testing\TestCase;
|
||||||
|
|
||||||
@@ -21,15 +22,11 @@ use Illuminate\Foundation\Testing\TestCase;
|
|||||||
* This is the abstract test case class.
|
* This is the abstract test case class.
|
||||||
*
|
*
|
||||||
* @author Graham Campbell <graham@alt-three.com>
|
* @author Graham Campbell <graham@alt-three.com>
|
||||||
|
* @author James Brooks <james@alt-three.com>
|
||||||
*/
|
*/
|
||||||
abstract class AbstractTestCase extends TestCase
|
abstract class AbstractTestCase extends TestCase
|
||||||
{
|
{
|
||||||
/**
|
use CreatesApplicationTrait;
|
||||||
* The base URL to use while testing the application.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected $baseUrl = 'http://localhost';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test actor.
|
* Test actor.
|
||||||
@@ -38,20 +35,6 @@ abstract class AbstractTestCase extends TestCase
|
|||||||
*/
|
*/
|
||||||
protected $user;
|
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.
|
* Sign in an user if it's the case.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -24,6 +24,11 @@ class AnalysisTest extends TestCase
|
|||||||
{
|
{
|
||||||
use AnalysisTrait;
|
use AnalysisTrait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the code paths to analyze.
|
||||||
|
*
|
||||||
|
* @return string[]
|
||||||
|
*/
|
||||||
protected function getPaths()
|
protected function getPaths()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Cachet.
|
||||||
|
*
|
||||||
|
* (c) Alt Three Services Limited
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CachetHQ\Tests\Cachet;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Console\Kernel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the creates application trait.
|
||||||
|
*
|
||||||
|
* @author James Brooks <james@alt-three.com>
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,13 +13,29 @@ namespace CachetHQ\Tests\Cachet\Foundation\Providers;
|
|||||||
|
|
||||||
use AltThree\TestBench\EventServiceProviderTrait;
|
use AltThree\TestBench\EventServiceProviderTrait;
|
||||||
use CachetHQ\Tests\Cachet\AbstractTestCase;
|
use CachetHQ\Tests\Cachet\AbstractTestCase;
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
use ReflectionClass;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the event service provider test class.
|
* This is the event service provider test class.
|
||||||
*
|
*
|
||||||
* @author Graham Campbell <graham@alt-three.com>
|
* @author Graham Campbell <graham@alt-three.com>
|
||||||
|
* @author James Brooks <james@alt-three.com>
|
||||||
*/
|
*/
|
||||||
class EventServiceProviderTest extends AbstractTestCase
|
class EventServiceProviderTest extends AbstractTestCase
|
||||||
{
|
{
|
||||||
use EventServiceProviderTrait;
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user