本文整理汇总了PHP中PHPUnit_Util_Type::toString方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Util_Type::toString方法的具体用法?PHP PHPUnit_Util_Type::toString怎么用?PHP PHPUnit_Util_Type::toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Util_Type
的用法示例。
在下文中一共展示了PHPUnit_Util_Type::toString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: toString
public function toString()
{
return sprintf(
'return user-specified value %s',
PHPUnit_Util_Type::toString($this->value)
);
}
示例2: toString
public function toString()
{
return sprintf(
'raise user-specified exception %s',
PHPUnit_Util_Type::toString($this->exception)
);
}
示例3: invoke
/**
* @param PHPUnit_Framework_MockObject_Invocation $invocation
* @return the invocation of the Entry with matching parameters.
*/
public function invoke(PHPUnit_Framework_MockObject_Invocation $invocation)
{
foreach ($this->return_map as $entry) {
if ($entry->matches($invocation)) {
return $entry->invoke($invocation);
}
}
PHPUnit_Framework_Assert::fail(sprintf('No return value defined for %s', PHPUnit_Util_Type::toString($invocation->parameters)));
}
示例4: toString
/**
* Returns a string describing the type difference between the expected
* and the actual value.
*/
public function toString()
{
return sprintf(
'%s does not match expected type "%s".',
PHPUnit_Util_Type::toString($this->actual),
gettype($this->expected)
);
}
示例5: getActualValue
/**
* For layout, actual value should be always set
* (non-PHPdoc)
* @see Mage_PHPUnit_Constraint_Abstract::getActualValue()
*/
protected function getActualValue($other)
{
if ($this->_useActualValue) {
if (is_array($this->_actualValue)) {
return PHPUnit_Util_Type::toString($this->_actualValue);
}
return parent::getActualValue($other);
}
return '';
}
示例6: toString
/**
* Returns a string describing the difference between the expected and the
* actual scalar value.
*/
public function toString()
{
return sprintf(
'Failed asserting that %s %s %s.',
PHPUnit_Util_Type::toString($this->actual),
$this->identical ? 'is identical to' : 'matches expected',
PHPUnit_Util_Type::toString($this->expected)
);
}
示例7: getActualValue
/**
* Returning user friendly actual value
* (non-PHPdoc)
* @see Mage_PHPUnit_Constraint_Abstract::getActualValue()
*/
protected function getActualValue($other)
{
if ($this->_useActualValue) {
if ($this->_actualValue instanceof Varien_Object) {
$value = $this->_actualValue->debug();
} else {
$value = $this->_actualValue;
}
return PHPUnit_Util_Type::toString($value);
}
return '';
}
示例8: fail
public function fail($other, $description, \SebastianBergmann\Comparator\ComparisonFailure $comparisonFailure = NULL)
{
throw new PHPUnit_Framework_ExpectationFailedException(sprintf('%sFailed asserting that %s contains a query element that restricts the search to groups', !empty($description) ? $description . "\n" : '', PHPUnit_Util_Type::toString($other, TRUE)), NULL);
}
示例9: toString
/**
* Returns a string representation of the constraint.
*
* @return string
*/
public function toString()
{
return 'is greater than ' . PHPUnit_Util_Type::toString($this->value);
}
示例10: toString
/**
* Returns a string representation of the constraint.
*
* @return string
*/
public function toString()
{
return 'has the key ' . PHPUnit_Util_Type::toString($this->key);
}
示例11: shortenedString
public static function shortenedString($string)
{
$string = preg_replace('#\\n|\\r\\n|\\r#', ' ', $string);
if (strlen($string) > 14) {
return PHPUnit_Util_Type::toString(substr($string, 0, 7) . '...' . substr($string, -7));
} else {
return PHPUnit_Util_Type::toString($string);
}
}
示例12: getNumber
/**
* Send a command to the Selenium RC server and treat the result
* as a number.
*
* @param string $command
* @param array $arguments
* @return numeric
* @author Shin Ohno <ganchiku@gmail.com>
* @author Bjoern Schotte <schotte@mayflower.de>
*/
protected function getNumber($command, array $arguments)
{
$result = $this->getString($command, $arguments);
if (!is_numeric($result)) {
$this->stop();
throw new PHPUnit_Framework_Exception('Result is not numeric: ' . PHPUnit_Util_Type::toString($result, TRUE));
}
return $result;
}
示例13: toString
/**
* Returns a string describing the difference between the expected and the
* actual array.
*
* @return string
*/
public function toString()
{
if (!$this->identical) {
ksort($this->expected);
ksort($this->actual);
}
$diff = PHPUnit_Util_Diff::diff(print_r($this->expected, TRUE), print_r($this->actual, TRUE));
if ($diff !== FALSE) {
return trim($diff);
}
// Fallback: Either diff is not available or the print_r() output for
// the expected and the actual array are equal (but the arrays are not).
$expectedOnly = array();
$actualOnly = array();
$diff = '';
foreach ($this->expected as $expectedKey => $expectedValue) {
if (!array_key_exists($expectedKey, $this->actual)) {
$expectedOnly[] = $expectedKey;
continue;
}
if ($expectedValue === $this->actual[$expectedKey]) {
continue;
}
$diffObject = PHPUnit_Framework_ComparisonFailure::diffIdentical($expectedValue, $this->actual[$expectedKey], sprintf('%sarray key %s: ', $this->message, PHPUnit_Util_Type::toString($expectedKey)));
$diff .= $diffObject->toString() . "\n";
}
foreach ($this->actual as $actualKey => $actualValue) {
if (!array_key_exists($actualKey, $this->expected)) {
$actualOnly[] = $actualKey;
continue;
}
}
foreach ($expectedOnly as $expectedKey) {
$diff .= sprintf("array key %s: only in expected %s\n", PHPUnit_Util_Type::toString($expectedKey), PHPUnit_Util_Type::toString($this->expected[$expectedKey]));
}
foreach ($actualOnly as $actualKey) {
$diff .= sprintf("array key %s: only in actual %s\n", PHPUnit_Util_Type::toString($actualKey), PHPUnit_Util_Type::toString($this->actual[$actualKey]));
}
return $diff;
}
示例14: toString
/**
* Returns a string representation of the constraint.
*
* @return string
*/
public function toString()
{
return "is equivalent to the SQL query " . \PHPUnit_Util_Type::toString($this->sql);
}
示例15: toString
/**
* Returns a string representation of the constraint.
*
* @return string
*/
public function toString()
{
return "produces" . \PHPUnit_Util_Type::toString($this->value) . "when iterated over";
}