public static function assertSame($var1, $var2, $message = '') { parent::assertSame($var1, $var2, $message); // assertEquals() throws an exception if not true, so the following // won't occur unless the messages actually are the same $success = print_r($var1, true) . ' is the same as ' . print_r($var2, true); self::$messages = array_merge(self::$messages, array($success)); }
/** * @Given /^I should be blocked$/ */ public function iShouldBeBlocked() { WebTestCase::assertSame(500, $this->getMainContext()->getSession()->getStatusCode()); }
public static function assertSame($var1, $var2, $message = '') { parent::assertSame($var1, $var2, $message); $success = print_r($var1, true) . ' is the same as ' . print_r($var2, true); self::$messages = array_merge(self::$messages, array($success)); }
/** * @Given /^the user should be banned$/ */ public function shouldBeBanned() { $elements = $this->getPage()->findAll('css', 'table > tbody > tr'); $didFindBanStatus = false; $result = 0; foreach ($elements as $element) { $cells = $element->findAll('css', 'td'); if (strpos(strtolower($cells[0]->getText()), 'ban status') !== false) { $didFindBanStatus = true; $banStatus = strtolower($cells[1]->getText()); if (strpos($banStatus, 'banned') !== false) { $result = self::RESULT_BANNED; } if (strpos($banStatus, 'active') !== false) { $result = self::RESULT_ACTIVE; } break; } } WebTestCase::assertTrue($didFindBanStatus, "ban status was not found."); WebTestCase::assertSame(self::RESULT_BANNED, $result, "user should is active but should be banned."); }