Created
October 9, 2021 05:12
-
-
Save jsdecena/86836c561d30bbf4ae6734a42b3e1fd2 to your computer and use it in GitHub Desktop.
Simple TDD - Timezone test - success
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Jsdecena\Simpletdd\Tests\Unit; | |
use Carbon\Carbon; | |
use DateTimeZone; | |
use Illuminate\Foundation\Application; | |
use Orchestra\Testbench\TestCase; | |
class TimezoneTest extends TestCase | |
{ | |
protected function setUp(): void | |
{ | |
parent::setUp(); | |
} | |
/** | |
* Define environment setup. | |
* | |
* @param Application $app | |
* @return void | |
*/ | |
protected function getEnvironmentSetUp($app) | |
{ | |
// Setup default database to use sqlite :memory: | |
$app['config']->set('simpletdd.timezone', 'America/Los_Angeles'); | |
} | |
/** | |
* @param Application $app | |
* @return array | |
*/ | |
protected function getPackageProviders($app) | |
{ | |
return ['Jsdecena\SimpleTdd\ServiceProvider']; | |
} | |
/** @test */ | |
public function it_should_get_the_config_tz() | |
{ | |
$tzNow = Carbon::now(new DateTimeZone(config('simpletdd.timezone'))); | |
$this->assertEquals("America/Los_Angeles", $tzNow->getTimezone()->getName()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment