'Australia/Eucla']); $this->app->instance('config', $config); /** @var ConfigureEnvironmentServiceProvider|MockObject $serviceProvider */ $serviceProvider = $this->getMockBuilder(ConfigureEnvironmentServiceProvider::class) ->setConstructorArgs([$this->app]) ->onlyMethods(['setTimeZone']) ->getMock(); $serviceProvider->expects($this->once()) ->method('setTimeZone') ->willReturnCallback(function (CarbonTimeZone $timeZone) { $this->assertEquals('Australia/Eucla', $timeZone->getName()); }); $serviceProvider->register(); } }