public function cmp_ok($exp1, $op, $exp2, $message = '') { switch ($op) { case '==': case '===': assertEquals($exp2, $exp1); break; case '!=': case '!==': assertNotEquals($exp2, $exp1); break; case '>': assertGreaterThan($exp2, $exp1); break; case '<': assertLessThan($exp2, $exp1); break; case '>=': assertGreaterThanOrEqual($exp2, $exp1); break; case '<=': assertLessThanOrEqual($exp2, $exp1); break; } }
/** * Asserts that we have less than a minute interval between the product updated date and the argument * * @Then /^the (product "([^"]+)") updated date should be close to "([^"]+)"$/ */ public function theProductUpdatedDateShouldBeCloseTo(ProductInterface $product, $identifier, $expected) { assertLessThan(60, abs(strtotime($expected) - $product->getUpdated()->getTimestamp())); }
/** * @Then Assert the value :arg1 is less than :arg2 * @param $expected * @param $actual */ public function assertLessThan($actual, $expected) { assertLessThan($expected, $actual, sprintf("Assert the value [%s] is less than [%s]", $actual, $expected)); }