|
|
@ -15,21 +15,29 @@ class ConfigureEnvironmentServiceProviderTest extends ServiceProviderTest
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function testRegister()
|
|
|
|
public function testRegister()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$config = new Config(['timezone' => 'Australia/Eucla']);
|
|
|
|
$config = new Config(['timezone' => 'Australia/Eucla', 'environment' => 'production']);
|
|
|
|
$this->app->instance('config', $config);
|
|
|
|
$this->app->instance('config', $config);
|
|
|
|
|
|
|
|
|
|
|
|
/** @var ConfigureEnvironmentServiceProvider|MockObject $serviceProvider */
|
|
|
|
/** @var ConfigureEnvironmentServiceProvider|MockObject $serviceProvider */
|
|
|
|
$serviceProvider = $this->getMockBuilder(ConfigureEnvironmentServiceProvider::class)
|
|
|
|
$serviceProvider = $this->getMockBuilder(ConfigureEnvironmentServiceProvider::class)
|
|
|
|
->setConstructorArgs([$this->app])
|
|
|
|
->setConstructorArgs([$this->app])
|
|
|
|
->onlyMethods(['setTimeZone'])
|
|
|
|
->onlyMethods(['setTimeZone', 'displayErrors', 'errorReporting'])
|
|
|
|
->getMock();
|
|
|
|
->getMock();
|
|
|
|
|
|
|
|
|
|
|
|
$serviceProvider->expects($this->once())
|
|
|
|
$serviceProvider->expects($this->exactly(2))
|
|
|
|
->method('setTimeZone')
|
|
|
|
->method('setTimeZone')
|
|
|
|
->willReturnCallback(function (CarbonTimeZone $timeZone) {
|
|
|
|
->willReturnCallback(function (CarbonTimeZone $timeZone) {
|
|
|
|
$this->assertEquals('Australia/Eucla', $timeZone->getName());
|
|
|
|
$this->assertEquals('Australia/Eucla', $timeZone->getName());
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
$serviceProvider->expects($this->exactly(3))
|
|
|
|
|
|
|
|
->method('displayErrors')
|
|
|
|
|
|
|
|
->withConsecutive([false], [false], [true]);
|
|
|
|
|
|
|
|
$serviceProvider->expects($this->exactly(1))
|
|
|
|
|
|
|
|
->method('errorReporting')
|
|
|
|
|
|
|
|
->with(E_ALL);
|
|
|
|
|
|
|
|
|
|
|
|
$serviceProvider->register();
|
|
|
|
$serviceProvider->register();
|
|
|
|
|
|
|
|
$config->set('environment', 'development');
|
|
|
|
|
|
|
|
$serviceProvider->register();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|