-
Thomas Flori authored
Camel case is not supported by some database. Postgres for example returns every column name in lower case. That does not lead to errors but even more dangerous it jus silently fails when you try to access `Migration::$executionTime`.
Unverifiedb340058e
CreateMigrationTableTest.php 1.21 KiB
<?php
namespace Breyta\Test\Migration;
use Breyta\BasicAdapter;
use Breyta\Migration\CreateMigrationTable;
use Breyta\Test\TestCase;
use Mockery as m;
class CreateMigrationTableTest extends TestCase
{
/** @test */
public function createsATable()
{
$adapter = m::mock(BasicAdapter::class)->shouldIgnoreMissing();
$migration = new CreateMigrationTable($adapter);
$migration->up();
$adapter->shouldHaveReceived('exec')->with(m::pattern('/create table migrations/i'))->once();
}
/** @test */
public function createIndexesOnMigrationTable()
{
$adapter = m::mock(BasicAdapter::class)->shouldIgnoreMissing();
$migration = new CreateMigrationTable($adapter);
$migration->up();
$adapter->shouldHaveReceived('exec')
->with(m::pattern('/create index.* on migrations\s*\(\s*executed\s*\)/i'))
->once();
$adapter->shouldHaveReceived('exec')
->with(m::pattern('/create index.* on migrations\s*\(\s*status\s*\)/i'))
->once();
$adapter->shouldHaveReceived('exec')
->with(m::pattern('/create index.* on migrations\s*\(\s*execution_time\s*\)/i'))
->once();
}
}