Merge pull request #1852 from CachetHQ/tests

Added more service provider tests
This commit is contained in:
Graham Campbell
2016-05-28 16:27:35 +01:00
7 changed files with 131 additions and 3 deletions

View File

@@ -37,7 +37,7 @@ class RepositoryServiceProvider extends ServiceProvider
*/
protected function registerMetricRepository()
{
$this->app->singleton('cachet.metricrepository', function ($app) {
$this->app->singleton(MetricRepository::class, function ($app) {
$dbDriver = $app['config']->get('database.default');
if ($dbDriver == 'mysql') {
@@ -52,7 +52,5 @@ class RepositoryServiceProvider extends ServiceProvider
return new MetricRepository($repository, $dates);
});
$this->app->alias('cachet.metricrepository', MetricRepository::class);
}
}

View File

@@ -12,6 +12,8 @@
namespace CachetHQ\Tests\Cachet\Foundation\Providers;
use AltThree\TestBench\ServiceProviderTrait;
use CachetHQ\Cachet\Dates\DateFactory;
use CachetHQ\Cachet\GitHub\Release;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
@@ -22,4 +24,14 @@ use CachetHQ\Tests\Cachet\AbstractTestCase;
class AppServiceProviderTest extends AbstractTestCase
{
use ServiceProviderTrait;
public function testDateFactoryIsInjectable()
{
$this->assertIsInjectable(DateFactory::class);
}
public function testReleaseIsInjectable()
{
$this->assertIsInjectable(Release::class);
}
}

View File

@@ -0,0 +1,25 @@
<?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\Foundation\Providers;
use AltThree\TestBench\ServiceProviderTrait;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
* This is the composer service provider test class.
*
* @author Graham Campbell <graham@alt-three.com>
*/
class ComposerServiceProviderTest extends AbstractTestCase
{
use ServiceProviderTrait;
}

View File

@@ -0,0 +1,37 @@
<?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\Foundation\Providers;
use AltThree\TestBench\ServiceProviderTrait;
use CachetHQ\Cachet\Settings\Cache;
use CachetHQ\Cachet\Settings\Repository;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
* This is the config service provider test class.
*
* @author Graham Campbell <graham@alt-three.com>
*/
class ConfigServiceProviderTest extends AbstractTestCase
{
use ServiceProviderTrait;
public function testCacheIsInjectable()
{
$this->assertIsInjectable(Cache::class);
}
public function testRepositoryIsInjectable()
{
$this->assertIsInjectable(Repository::class);
}
}

View File

@@ -0,0 +1,25 @@
<?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\Foundation\Providers;
use AltThree\TestBench\ServiceProviderTrait;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
* This is the console service provider test class.
*
* @author Graham Campbell <graham@alt-three.com>
*/
class ConsoleServiceProviderTest extends AbstractTestCase
{
use ServiceProviderTrait;
}

View File

@@ -12,6 +12,7 @@
namespace CachetHQ\Tests\Cachet\Foundation\Providers;
use AltThree\TestBench\ServiceProviderTrait;
use CachetHQ\Cachet\Repositories\Metric\MetricRepository;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
@@ -22,4 +23,9 @@ use CachetHQ\Tests\Cachet\AbstractTestCase;
class RepositoryServiceProviderTest extends AbstractTestCase
{
use ServiceProviderTrait;
public function testMetricRepositoryIsInjectable()
{
$this->assertIsInjectable(MetricRepository::class);
}
}

View File

@@ -0,0 +1,25 @@
<?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\Foundation\Providers;
use AltThree\TestBench\ServiceProviderTrait;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
* This is the route service provider test class.
*
* @author Graham Campbell <graham@alt-three.com>
*/
class RouteServiceProviderTest extends AbstractTestCase
{
use ServiceProviderTrait;
}