本文整理汇总了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);
}