本文整理汇总了PHP中PHPUnit_Framework_Assert::fail方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_Assert::fail方法的具体用法?PHP PHPUnit_Framework_Assert::fail怎么用?PHP PHPUnit_Framework_Assert::fail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Framework_Assert
的用法示例。
在下文中一共展示了PHPUnit_Framework_Assert::fail方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteFile
/**
* Deletes a file
*
* ``` php
* <?php
* $I->deleteFile('composer.lock');
* ?>
* ```
*
* @param $filename
*/
public function deleteFile($filename)
{
if (!file_exists($this->absolutizePath($filename))) {
\PHPUnit_Framework_Assert::fail('file not found');
}
unlink($this->absolutizePath($filename));
}
示例2: getMessagesCurrentCountOnQueue
/**
* Count the current number of messages on the queue.
*
* @param $queue Queue Name
*
* @return int Count
*/
public function getMessagesCurrentCountOnQueue($queue)
{
try {
return $this->queue->statsTube($queue)['current-jobs-ready'];
} catch (\Pheanstalk_Exception_ServerException $e) {
\PHPUnit_Framework_Assert::fail("queue [{$queue}] not found");
}
}
示例3: _testCreate
protected function _testCreate()
{
if ($this->_model->getId()) {
\PHPUnit_Framework_Assert::fail("Can't run creation test for models with defined id");
}
$this->_model->save();
\PHPUnit_Framework_Assert::assertNotEmpty($this->_model->getId(), 'CRUD Create error');
}
示例4: clearQueue
public function clearQueue($queue)
{
try {
$this->queue->clearQueue($queue);
} catch (\Http_Exception $ex) {
\PHPUnit_Framework_Assert::fail("queue [{$queue}] not found");
}
}
示例5: responseStatusCodeIs
/**
* @Then response status code is :code
*
* @param int $code
*/
public function responseStatusCodeIs($code)
{
if (!$this->api->getClient()->getLastResponse()) {
PHPUnit_Framework_Assert::fail();
}
$statusCode = $this->api->getClient()->getLastResponse()->getStatusCode();
PHPUnit_Framework_Assert::assertEquals($code, $statusCode);
}
示例6: seeElement
/**
* Checks element visibility.
* Fails if element exists but is invisible to user.
*
* @param $css
*/
public function seeElement($css)
{
$el = $this->session->getPage()->find('css', $css);
if (!$el) {
\PHPUnit_Framework_Assert::fail("Element {$css} not found");
}
\PHPUnit_Framework_Assert::assertTrue($this->session->getDriver()->isVisible($el->getXpath()));
}
示例7: 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)));
}
示例8: getIterator
/**
* @return Generator
*/
public function getIterator()
{
foreach ($this->stack as $index => $resource) {
if (!is_object($resource)) {
PHPUnit::fail(sprintf('Encountered a resource that is not an object at index %d', $index));
}
(yield $index => new ResourceTester($resource, $index));
}
}
示例9: thereIsAContentTypeWithId
/**
* @Given /^there is a Content Type "([^"]*)" with the id "([^"]*)"$/
*/
public function thereIsAContentTypeWithId($contentTypeIdentifier, $id)
{
try {
$contentType = $this->contentTypeService->loadContentTypeByIdentifier($contentTypeIdentifier);
Assertion::assertEquals($id, $contentType->id);
} catch (NotFoundException $e) {
Assertion::fail("No ContentType with the identifier '{$contentTypeIdentifier}' could be found.");
}
}
示例10: getIterator
/**
* @return Generator
*/
public function getIterator()
{
foreach ($this->errors as $index => $error) {
if (!is_object($error)) {
PHPUnit::fail(sprintf('Encountered an error that is not an object at index %d', $index));
}
(yield $index => new ErrorTester($error));
}
}
示例11: runTest
/**
* @access public
*/
protected function runTest()
{
$timer = new Benchmark_Timer();
$timer->start();
parent::runTest();
$timer->stop();
if ($this->fMaxRunningTime != 0 && $timer->timeElapsed() > $this->fMaxRunningTime) {
PHPUnit_Framework_Assert::fail(sprintf('expected running time: <= %s but was: %s', $this->fMaxRunningTime, $timer->timeElapsed()));
}
}
示例12: apc_store
function apc_store($key, $value)
{
if (count($GLOBALS['expected_apc_store_calls']) == 0) {
\PHPUnit_Framework_Assert::fail("Unexpected apc_store({$key}, {$value})");
}
$call = array_shift($GLOBALS['expected_apc_store_calls']);
\PHPUnit_Framework_Assert::assertEquals($call['args'][0], $key);
\PHPUnit_Framework_Assert::assertEquals($call['args'][1], $value);
return $call['ret'];
}
示例13: create
/**
* Create a document tester from a raw HTTP response content.
*
* @param string $responseContent
* @return DocumentTester
*/
public static function create($responseContent)
{
$decoded = json_decode($responseContent);
if (JSON_ERROR_NONE !== json_last_error()) {
PHPUnit::fail('Invalid response JSON: ' . json_last_error_msg());
}
if (!is_object($decoded)) {
PHPUnit::fail('Invalid JSON API response content.');
}
return new self($decoded);
}
示例14: usingServer
/**
* @Given /^Using server "([^"]*)"$/
*/
public function usingServer($server)
{
if ($server === 'LOCAL') {
$this->baseUrl = $this->localBaseUrl;
$this->currentServer = 'LOCAL';
} elseif ($server === 'REMOTE') {
$this->baseUrl = $this->remoteBaseUrl;
$this->currentServer = 'REMOTE';
} else {
PHPUnit_Framework_Assert::fail("Server can only be LOCAL or REMOTE");
}
}
示例15: 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);
}
}
if ($this->default != NULL) {
return $this->default->invoke($invocation);
}
PHPUnit_Framework_Assert::fail(sprintf('No return value defined for %s', $this->exporter->export($invocation->parameters)));
}