本文整理匯總了PHP中SimpleTestCase::assert方法的典型用法代碼示例。如果您正苦於以下問題:PHP SimpleTestCase::assert方法的具體用法?PHP SimpleTestCase::assert怎麽用?PHP SimpleTestCase::assert使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SimpleTestCase
的用法示例。
在下文中一共展示了SimpleTestCase::assert方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: assertType
/**
* Tests the type of a value.
* @param $value Value to take type of.
* @param $type Hoped for type.
* @param $message Message to display.
* @public
*/
function assertType($value, $type, $message = "%s")
{
parent::assert(new TrueExpectation(), gettype($value) == strtolower($type), $message);
}
示例2: atTestEnd
/**
* Receives event from unit test that the current
* test method has finished. Totals up the call
* counts and triggers a test assertion if a test
* is present for expected call counts.
* @param string $test_method Current method name.
* @param SimpleTestCase $test Test to send message to.
* @access public
*/
function atTestEnd($test_method, &$test)
{
foreach ($this->_expected_counts as $method => $expectation) {
$test->assert($expectation, $this->getCallCount($method));
}
foreach ($this->_max_counts as $method => $expectation) {
if ($expectation->test($this->getCallCount($method))) {
$test->assert($expectation, $this->getCallCount($method));
}
}
}
示例3: isExpected
/**
* Compares the expected exception with any
* in the queue. Issues a pass or fail and
* returns the state of the test.
* @param SimpleTestCase $test Test case to send messages to.
* @param Exception $exception Exception to compare.
* @return boolean False on no match.
*/
function isExpected($test, $exception)
{
if ($this->expected) {
return $test->assert($this->expected, $exception, $this->message);
}
foreach ($this->ignored as $ignored) {
if ($ignored->test($exception)) {
return true;
}
}
return false;
}
示例4: isExpected
/**
* Compares the expected exception with any
* in the queue. Issues a pass or fail and
* returns the state of the test.
* @param SimpleTestCase $test Test case to send messages to.
* @param Exception $exception Exception to compare.
* @return boolean False on no match.
*/
function isExpected($test, $exception)
{
if ($this->expected) {
return $test->assert($this->expected, $exception, $this->message);
}
return false;
}
示例5: assertRegexp
/**
* Tests a regex match.
* @param $pattern Regex to match.
* @param $subject String to search in.
* @param $message Message to display.
* @public
*/
function assertRegexp($pattern, $subject, $message = false)
{
parent::assert(new PatternExpectation($pattern), $subject, $message);
}