public function testNotEmptySnapshot()
 {
     $this->Task->params['require-table'] = false;
     $version = Util::getCurrentTimestamp();
     $this->Task->expects($this->once())->method('dispatchShell')->with('migrations', 'mark_migrated', $version);
     $result = $this->Task->bake('NotEmptySnapshot');
     $this->assertSameAsFile(__FUNCTION__ . '.php', $result);
 }
 public function testNotEmptySnapshot()
 {
     $this->Task->params['require-table'] = false;
     $this->Task->params['connection'] = 'test';
     $this->Task->params['plugin'] = 'BogusPlugin';
     $version = Util::getCurrentTimestamp();
     $this->Task->expects($this->once())->method('dispatchShell')->with($this->logicalAnd($this->stringContains('migrations mark_migrated'), $this->stringContains('-c test -p BogusPlugin')));
     $result = $this->Task->bake('NotEmptySnapshot');
     $this->assertSameAsFile(__FUNCTION__ . '.php', $result);
 }
示例#3
0
 public function testGetCurrentTimestamp()
 {
     $dt = new \DateTime('now', new \DateTimeZone('UTC'));
     $expected = $dt->format(Util::DATE_FORMAT);
     $current = Util::getCurrentTimestamp();
     // Rather than using a strict equals, we use greater/lessthan checks to
     // prevent false positives when the test hits the edge of a second.
     $this->assertGreaterThanOrEqual($expected, $current);
     // We limit the assertion time to 2 seconds, which should never fail.
     $this->assertLessThanOrEqual($expected + 2, $current);
 }