本文整理汇总了PHP中SMWQueryResult::getErrors方法的典型用法代码示例。如果您正苦于以下问题:PHP SMWQueryResult::getErrors方法的具体用法?PHP SMWQueryResult::getErrors怎么用?PHP SMWQueryResult::getErrors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SMWQueryResult
的用法示例。
在下文中一共展示了SMWQueryResult::getErrors方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: assertQueryResultErrorCode
private function assertQueryResultErrorCode($errorCode, QueryResult $queryResult)
{
if ($errorCode > 0) {
return $this->assertNotEmpty($queryResult->getErrors());
}
$this->assertEmpty($queryResult->getErrors());
}
示例2: getErrorString
/**
* Provides a simple formatted string of all the error messages that occurred.
* Can be used if not specific error formatting is desired. Compatible with HTML
* and Wiki.
*
* @param SMWQueryResult $res
*
* @return string
*/
public function getErrorString(SMWQueryResult $res)
{
return $this->mShowErrors ? smwfEncodeMessages(array_merge($this->mErrors, $res->getErrors())) : '';
}
示例3: assertThatQueryResultHasSubjects
/**
* @since 2.0
*
* @param mixed $expected
* @param QueryResult $queryResult
*/
public function assertThatQueryResultHasSubjects($expectedSubjects, QueryResult $queryResult)
{
$expectedSubjects = is_array($expectedSubjects) ? $expectedSubjects : array($expectedSubjects);
$expectedToCount = count($expectedSubjects);
$actualComparedToCount = 0;
$this->assertEmpty($queryResult->getErrors());
if ($expectedToCount == 0) {
return;
}
$resultSubjects = $queryResult->getResults();
foreach ($resultSubjects as $rKey => $resultSubject) {
foreach ($expectedSubjects as $ekey => $expectedSubject) {
if ($expectedSubject instanceof DIWikiPage && $expectedSubject->equals($resultSubject)) {
$actualComparedToCount++;
unset($expectedSubjects[$ekey]);
unset($resultSubjects[$rKey]);
}
}
}
$this->assertEquals($expectedToCount, $actualComparedToCount, 'Failed asserting that ' . implode(', ', $expectedSubjects) . ' is set.');
$this->assertEmpty($resultSubjects, 'Failed to match results [ ' . implode(', ', $resultSubjects) . ' ] against the expected subjects.');
}