|
|
@ -4,6 +4,7 @@ namespace Engelsystem\Test\Unit\Helpers;
|
|
|
|
|
|
|
|
|
|
|
|
use Carbon\CarbonTimeZone;
|
|
|
|
use Carbon\CarbonTimeZone;
|
|
|
|
use Engelsystem\Config\Config;
|
|
|
|
use Engelsystem\Config\Config;
|
|
|
|
|
|
|
|
use Engelsystem\Exceptions\Handler;
|
|
|
|
use Engelsystem\Helpers\ConfigureEnvironmentServiceProvider;
|
|
|
|
use Engelsystem\Helpers\ConfigureEnvironmentServiceProvider;
|
|
|
|
use Engelsystem\Test\Unit\ServiceProviderTest;
|
|
|
|
use Engelsystem\Test\Unit\ServiceProviderTest;
|
|
|
|
use PHPUnit\Framework\MockObject\MockObject;
|
|
|
|
use PHPUnit\Framework\MockObject\MockObject;
|
|
|
@ -12,12 +13,16 @@ class ConfigureEnvironmentServiceProviderTest extends ServiceProviderTest
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @covers \Engelsystem\Helpers\ConfigureEnvironmentServiceProvider::register
|
|
|
|
* @covers \Engelsystem\Helpers\ConfigureEnvironmentServiceProvider::register
|
|
|
|
|
|
|
|
* @covers \Engelsystem\Helpers\ConfigureEnvironmentServiceProvider::setupDevErrorHandler
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function testRegister()
|
|
|
|
public function testRegister()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$config = new Config(['timezone' => 'Australia/Eucla', 'environment' => 'production']);
|
|
|
|
$config = new Config(['timezone' => 'Australia/Eucla', 'environment' => 'production']);
|
|
|
|
$this->app->instance('config', $config);
|
|
|
|
$this->app->instance('config', $config);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$handler = new Handler();
|
|
|
|
|
|
|
|
$this->app->instance('error.handler', $handler);
|
|
|
|
|
|
|
|
|
|
|
|
/** @var ConfigureEnvironmentServiceProvider|MockObject $serviceProvider */
|
|
|
|
/** @var ConfigureEnvironmentServiceProvider|MockObject $serviceProvider */
|
|
|
|
$serviceProvider = $this->getMockBuilder(ConfigureEnvironmentServiceProvider::class)
|
|
|
|
$serviceProvider = $this->getMockBuilder(ConfigureEnvironmentServiceProvider::class)
|
|
|
|
->setConstructorArgs([$this->app])
|
|
|
|
->setConstructorArgs([$this->app])
|
|
|
@ -37,7 +42,10 @@ class ConfigureEnvironmentServiceProviderTest extends ServiceProviderTest
|
|
|
|
->with(E_ALL);
|
|
|
|
->with(E_ALL);
|
|
|
|
|
|
|
|
|
|
|
|
$serviceProvider->register();
|
|
|
|
$serviceProvider->register();
|
|
|
|
|
|
|
|
$this->assertNotEquals(Handler::ENV_DEVELOPMENT, $handler->getEnvironment());
|
|
|
|
|
|
|
|
|
|
|
|
$config->set('environment', 'development');
|
|
|
|
$config->set('environment', 'development');
|
|
|
|
$serviceProvider->register();
|
|
|
|
$serviceProvider->register();
|
|
|
|
|
|
|
|
$this->assertEquals(Handler::ENV_DEVELOPMENT, $handler->getEnvironment());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|