Skip to content

Instantly share code, notes, and snippets.

@jsdecena
Last active October 9, 2021 05:06
Show Gist options
  • Save jsdecena/5a7a84c974d9c618063c4ba26860f139 to your computer and use it in GitHub Desktop.
Save jsdecena/5a7a84c974d9c618063c4ba26860f139 to your computer and use it in GitHub Desktop.
Simple TDD - Timezone test, failed scenario
<?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();
$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