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); }
/** * {@inheritDoc} */ public function fileName($name) { $name = $this->getMigrationName($name); return Util::getCurrentTimestamp() . '_' . Inflector::camelize($name) . '.php'; }
/** * {@inheritDoc} */ public function main($name = null) { $this->__timestamp = Util::getCurrentTimestamp(); parent::main($name); }