当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPUnit_Framework_Assert::assertThat方法代码示例

本文整理汇总了PHP中PHPUnit_Framework_Assert::assertThat方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_Assert::assertThat方法的具体用法?PHP PHPUnit_Framework_Assert::assertThat怎么用?PHP PHPUnit_Framework_Assert::assertThat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPUnit_Framework_Assert的用法示例。


在下文中一共展示了PHPUnit_Framework_Assert::assertThat方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: assertResponseHeadersMatch

 /**
  * Asserts response headers match with the media types defined.
  *
  * @param string[] $headers
  * @param SchemaManager $schemaManager
  * @param string $path percent-encoded path used on the request.
  * @param string $httpMethod
  * @param int $httpCode
  * @param string $message
  */
 public function assertResponseHeadersMatch(array $headers, SchemaManager $schemaManager, $path, $httpMethod, $httpCode, $message = '')
 {
     if (!$schemaManager->findPathInTemplates($path, $template, $params)) {
         throw new \RuntimeException('Request URI does not match with any swagger path definition');
     }
     $constraint = new ResponseHeadersConstraint($schemaManager, $template, $httpMethod, $httpCode);
     Assert::assertThat($headers, $constraint, $message);
 }
开发者ID:Beanhunter,项目名称:SwaggerAssertions,代码行数:18,代码来源:AssertsTrait.php

示例2: matches

 /**
  * Evaluates the constraint for test case
  *
  * @param string $testCaseName
  * @return bool
  */
 protected function matches($testCaseName)
 {
     $result = true;
     foreach ($this->constraints as $constraint) {
         \PHPUnit_Framework_Assert::assertThat("", $constraint);
         $result = $result && $constraint->getResult();
     }
     return $result;
 }
开发者ID:Mohitsahu123,项目名称:mtf,代码行数:15,代码来源:Composite.php

示例3: assertNotContains

 /**
  * @param mixed  $needle
  * @param mixed  $haystack
  * @param string $message
  * @param bool   $ignoreCase
  * @param bool   $checkForObjectIdentity
  * @param bool   $checkForNonObjectIdentity
  */
 public static function assertNotContains($needle, $haystack, $message = '', $ignoreCase = false, $checkForObjectIdentity = true, $checkForNonObjectIdentity = false)
 {
     if (is_array($haystack) || is_object($haystack) && $haystack instanceof \Traversable) {
         $constraint = new \PHPUnit_Framework_Constraint_Not(self::contains($needle, $checkForObjectIdentity, $checkForNonObjectIdentity));
     } elseif (is_string($haystack)) {
         if (!is_string($needle)) {
             throw \PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string');
         }
         $constraint = new \PHPUnit_Framework_Constraint_Not(new \PHPUnit_Framework_Constraint_StringContains($needle, $ignoreCase));
     } else {
         throw \PHPUnit_Util_InvalidArgumentHelper::factory(2, 'array, traversable or string');
     }
     \PHPUnit_Framework_Assert::assertThat($haystack, $constraint, $message);
 }
开发者ID:f500,项目名称:equatable,代码行数:22,代码来源:EquatableAssertionCapabilities.php

示例4: thatHandles

 /**
  * @test
  */
 public function thatHandles()
 {
     $messages = array(new Message(self::DUMMY_MESSAGE_UNIQUE_ID, self::DUMMY_MESSAGE_ID, self::DUMMY_MESSAGE_SUBJECT, self::DUMMY_MESSAGE_CONTENT, $this->getDummyFrom(), self::DUMMY_MESSAGE_TO, self::DUMMY_MESSAGE_REFERENCE));
     $strategies = array($this->strategy);
     $this->provider->expects($this->once())->method('fetchMessagesToProcess')->will($this->returnValue($messages));
     $this->strategyHolder->expects($this->once())->method('getStrategies')->will($this->returnValue($strategies));
     $this->context->expects($this->exactly(count($strategies)))->method('setStrategy')->with($this->isInstanceOf('\\Diamante\\EmailProcessingBundle\\Model\\Processing\\Strategy'));
     $this->context->expects($this->exactly(count($messages) * count($strategies)))->method('execute')->with($this->isInstanceOf('Diamante\\EmailProcessingBundle\\Model\\Message'));
     $this->provider->expects($this->once())->method('markMessagesAsProcessed')->with($this->logicalAnd($this->isType(\PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY), $this->countOf(count($messages)), $this->callback(function ($other) {
         $result = true;
         foreach ($other as $message) {
             $constraint = \PHPUnit_Framework_Assert::isInstanceOf('Diamante\\EmailProcessingBundle\\Model\\Message');
             try {
                 \PHPUnit_Framework_Assert::assertThat($message, $constraint);
             } catch (\PHPUnit_Framework_ExpectationFailedException $e) {
                 $result = false;
             }
         }
         return $result;
     })));
     $this->manager->handle($this->provider);
 }
开发者ID:gitter-badger,项目名称:diamantedesk-application,代码行数:25,代码来源:MessageProcessingManagerTest.php

示例5: thatHandlesAndMarksMessages

 /**
  * @test
  */
 public function thatHandlesAndMarksMessages()
 {
     $messages = $this->getMessages();
     $strategies = array($this->strategy);
     $this->settings->expects($this->any())->method('getDeleteProcessedMessages')->will($this->returnValue(false));
     $this->provider->expects($this->once())->method('fetchMessagesToProcess')->will($this->returnValue($messages));
     $this->strategyHolder->expects($this->once())->method('getStrategies')->will($this->returnValue($strategies));
     $this->context->expects($this->exactly(count($strategies)))->method('setStrategy')->with($this->isInstanceOf('\\Diamante\\EmailProcessingBundle\\Model\\Processing\\Strategy'));
     $this->context->expects($this->exactly(count($messages) * count($strategies)))->method('execute')->with($this->isInstanceOf('Diamante\\EmailProcessingBundle\\Model\\Message'));
     $this->provider->expects($this->once())->method('markMessagesAsProcessed')->with($this->logicalAnd($this->isType(\PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY), $this->countOf(count($messages)), $this->callback(function ($other) {
         $result = true;
         foreach ($other as $message) {
             $constraint = \PHPUnit_Framework_Assert::isInstanceOf('Diamante\\EmailProcessingBundle\\Model\\Message');
             try {
                 \PHPUnit_Framework_Assert::assertThat($message, $constraint);
             } catch (\PHPUnit_Framework_ExpectationFailedException $e) {
                 $result = false;
             }
         }
         return $result;
     })));
     $this->manager->handle($this->provider);
 }
开发者ID:eltrino,项目名称:DiamanteEmailProcessingBundle,代码行数:26,代码来源:MessageProcessingManagerTest.php

示例6: assertStringMatchIgnoreWhitespace

 /**
  * Asserts that the two strings match but that all whitespaces are 
  * not necessarily equal.
  *
  * @param array $expected
  * @param array $actual
  * @param string $message
  */
 public static function assertStringMatchIgnoreWhitespace($expected, $actual, $message = '')
 {
     PHPUnit_Framework_Assert::assertThat($actual, new PHPUnit_Extensions_Constraint_StringMatchIgnoreWhitespace($expected), $message);
 }
开发者ID:etsy,项目名称:phpunit-extensions,代码行数:12,代码来源:More.php

示例7: seeResponseContainsJson

 /**
  * Checks whether the last JSON response contains provided array.
  * The response is converted to array with json_decode($response, true)
  * Thus, JSON is represented by associative array.
  * This method matches that response array contains provided array.
  *
  * Examples:
  *
  * ``` php
  * <?php
  * // response: {name: john, email: john@gmail.com}
  * $I->seeResponseContainsJson(array('name' => 'john'));
  *
  * // response {user: john, profile: { email: john@gmail.com }}
  * $I->seeResponseContainsJson(array('email' => 'john@gmail.com'));
  *
  * ?>
  * ```
  *
  * This method recursively checks if one array can be found inside of another.
  *
  * @param array $json
  * @part json
  */
 public function seeResponseContainsJson($json = [])
 {
     \PHPUnit_Framework_Assert::assertThat($this->connectionModule->_getResponseContent(), new JsonContains($json));
 }
开发者ID:solutionDrive,项目名称:Codeception,代码行数:28,代码来源:REST.php

示例8: assertThat

/**
 * Evaluates a PHPUnit_Framework_Constraint matcher object.
 *
 * @param  mixed$value
 * @param  PHPUnit_Framework_Constraint $constraint
 * @param  string   $message
 * @since  Method available since Release 3.0.0
 */
function assertThat($value, PHPUnit_Framework_Constraint $constraint, $message = '')
{
    return PHPUnit_Framework_Assert::assertThat($value, $constraint, $message);
}
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:12,代码来源:Functions.php

示例9: assertValid

 /**
  * Asserts protocol version is valid.
  *
  * Protocol version MUST be:
  * - String type.
  * - Valid HTTP protocol version number.
  *
  * @param string $protocolVersion
  * @param string $message
  */
 public static function assertValid($protocolVersion, $message = '')
 {
     Assert::assertThat($protocolVersion, new self(), $message);
 }
开发者ID:viserio,项目名称:http,代码行数:14,代码来源:HttpProtocolVersion.php

示例10: processObjectFreeze

 public function processObjectFreeze()
 {
     PHPUnit_Framework_Assert::assertThat(true, PHPUnit_Framework_Assert::isTrue());
 }
开发者ID:eric-seekas,项目名称:Phake,代码行数:4,代码来源:PHPUnit.php

示例11: theResponseIsJson

 /**
  * @Then the response should be json/JSON
  * @Then the response is json/JSON
  */
 public function theResponseIsJson()
 {
     Assert::assertThat(static::$response->headers->get('Content-Type'), Assert::logicalOr(Assert::stringStartsWith('application/json'), Assert::stringStartsWith('text/javascript')));
     Assert::assertJson($this->getResponseContent());
 }
开发者ID:treehouselabs,项目名称:base-api-bundle,代码行数:9,代码来源:ApiContext.php

示例12: shouldNotContain

 public function shouldNotContain($value)
 {
     Assert::assertThat($this->it, Assert::logicalNot(Assert::contains($value)));
 }
开发者ID:pago,项目名称:pantr,代码行数:4,代码来源:Matcher.php

示例13: assertRequestIsDelete

 public static function assertRequestIsDelete(RequestInterface $request)
 {
     Assert::assertThat($request, static::isDelete());
 }
开发者ID:martin-helmich,项目名称:phpunit-psr7-assert,代码行数:4,代码来源:Psr7Assertions.php

示例14: assertImmutable

 /**
  * Asserts two objects are the same type but not the same instance.
  *
  * @param object $original
  * @param object $new
  * @param string $message
  */
 public static function assertImmutable($original, $new, $message = '')
 {
     Assert::assertThat($new, new self($original), $message);
 }
开发者ID:viserio,项目名称:http,代码行数:11,代码来源:Immutable.php

示例15: assertDefinitionSchema

 /**
  * @param Spec $spec
  * @param string $class
  * @param mixed $actual
  * @param string $msg
  */
 protected static final function assertDefinitionSchema(Spec $spec, $class, $actual, $msg = '')
 {
     Assert::assertThat($actual, new JsonSchemaConstraint($spec->getDefinition($class)), $msg);
 }
开发者ID:rebilly,项目名称:openapi-php,代码行数:10,代码来源:Asserts.php


注:本文中的PHPUnit_Framework_Assert::assertThat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。