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


PHP PHPUnit_Framework_Assert::equalTo方法代码示例

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


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

示例1: __construct

 public function __construct($status)
 {
     parent::__construct();
     if (!$status instanceof Constraint) {
         $status = Assert::equalTo($status);
     }
     $this->status = $status;
 }
开发者ID:martin-helmich,项目名称:phpunit-psr7-assert,代码行数:8,代码来源:HasStatusConstraint.php

示例2: assertEqualAggregatedRoot

 protected function assertEqualAggregatedRoot(RecordsMessages $expected)
 {
     return m::on(function (RecordsMessages $actual) use($expected) {
         $actual = clone $actual;
         $actual->eraseMessages();
         return Assertions::equalTo($expected)->evaluate($actual, '', true);
     });
 }
开发者ID:JavierCane,项目名称:mpwar,代码行数:8,代码来源:UnitTestCase.php

示例3: expects

 /**
  * Generates a mock object on the singleton Someclass util object.
  *
  * @param array $name
  * @return void
  */
 public static function expects($name, $replace)
 {
     // Mock the object
     $mock = \PHPUnit_Framework_MockObject_Generator::getMock('Someclass', array('hello'), array(), '', false);
     // Replace protected self reference with mock object
     $ref = new \ReflectionProperty('Someclass', 'self');
     $ref->setAccessible(true);
     $ref->setValue(null, $mock);
     // Set expectations and return values
     $mock->expects(new \PHPUnit_Framework_MockObject_Matcher_InvokedCount(1))->method('hello')->with(\PHPUnit_Framework_Assert::equalTo($name))->will(new \PHPUnit_Framework_MockObject_Stub_Return($replace));
 }
开发者ID:pkdevboxy,项目名称:zumba.github.com,代码行数:17,代码来源:someclass_mock.php

示例4: __construct

 public function __construct($name, $constraint = null)
 {
     parent::__construct();
     if ($constraint === null) {
         $constraint = Assert::logicalNot(Assert::isEmpty());
     } elseif (!$constraint instanceof Constraint) {
         $constraint = Assert::equalTo($constraint);
     }
     $this->name = strtolower($name);
     $this->constraint = $constraint;
 }
开发者ID:martin-helmich,项目名称:phpunit-psr7-assert,代码行数:11,代码来源:HasHeaderConstraint.php

示例5: equalTo

/**
 * Returns a PHPUnit_Framework_Constraint_IsEqual matcher object.
 *
 * @param  mixed   $value
 * @param  float   $delta
 * @param  integer $maxDepth
 * @param  boolean $canonicalize
 * @param  boolean $ignoreCase
 * @return PHPUnit_Framework_Constraint_IsEqual
 * @since  Method available since Release 3.0.0
 */
function equalTo($value, $delta = 0, $maxDepth = 10, $canonicalize = FALSE, $ignoreCase = FALSE)
{
    return PHPUnit_Framework_Assert::equalTo($value, $delta, $maxDepth, $canonicalize, $ignoreCase);
}
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:15,代码来源:Functions.php

示例6: testConstraintIsNotEqual2

 /**
  * @covers PHPUnit_Framework_Constraint_IsEqual
  * @covers PHPUnit_Framework_Constraint_Not
  * @covers PHPUnit_Framework_Assert::equalTo
  * @covers PHPUnit_Framework_Assert::logicalNot
  */
 public function testConstraintIsNotEqual2()
 {
     $constraint = PHPUnit_Framework_Assert::logicalNot(PHPUnit_Framework_Assert::equalTo(1));
     try {
         $constraint->fail(1, 'custom message', TRUE);
     } catch (PHPUnit_Framework_ExpectationFailedException $e) {
         $this->assertEquals("custom message\nFailed asserting that <integer:1> is not equal to <integer:1>.", $e->getDescription());
         return;
     }
     $this->fail();
 }
开发者ID:kdambekalns,项目名称:framework-benchs,代码行数:17,代码来源:ConstraintTest.php

示例7: testConstraintIsNotEqual2

    /**
     * @covers PHPUnit_Framework_Constraint_IsEqual
     * @covers PHPUnit_Framework_Constraint_Not
     * @covers PHPUnit_Framework_Assert::equalTo
     * @covers PHPUnit_Framework_Assert::logicalNot
     * @covers PHPUnit_Framework_TestFailure::exceptionToString
     */
    public function testConstraintIsNotEqual2()
    {
        $constraint = PHPUnit_Framework_Assert::logicalNot(PHPUnit_Framework_Assert::equalTo(1));
        try {
            $constraint->evaluate(1, 'custom message');
        } catch (PHPUnit_Framework_ExpectationFailedException $e) {
            $this->assertEquals(<<<EOF
custom message
Failed asserting that 1 is not equal to 1.

EOF
, PHPUnit_Framework_TestFailure::exceptionToString($e));
            return;
        }
        $this->fail();
    }
开发者ID:ProgrammingPeter,项目名称:nba-schedule-api,代码行数:23,代码来源:ConstraintTest.php

示例8: iShouldSeeAVailidThumbnailForImageWithAlternativeText

 /**
  * Test if image is present on page and is downloadable (`img` tag must contain `alt` attribute).
  * @Then I (should) see a valid thumbnail for image with alternative text :imageAlternativeText
  */
 public function iShouldSeeAVailidThumbnailForImageWithAlternativeText($imageAlternativeText)
 {
     $image = $this->getXpath()->findXpath("//img[contains(@alt, '" . $imageAlternativeText . "')]");
     if (count($image) == 0) {
         throw new \Exception(sprintf('Image with an alternative text `%s` was not found', $imageAlternativeText));
     }
     $file = $image[0]->getAttribute('src');
     $client = new \Guzzle\Http\Client();
     $request = $client->get($this->locatePath($file));
     $response = $request->send();
     Assertion::equalTo($response->getStatusCode(), 200);
     Assertion::assertRegexp('/image\\/(.*)/', $response->getHeader('content-type')->__toString());
 }
开发者ID:ezsystems,项目名称:demobundle,代码行数:17,代码来源:Context.php

示例9: testBodyMatchesCanFail

 /**
  * @expectedException \PHPUnit_Framework_AssertionFailedError
  */
 public function testBodyMatchesCanFail()
 {
     $request = new Request('GET', '/', [], 'foobar');
     $this->assertMessageBodyMatches($request, Assert::equalTo('barbaz'));
 }
开发者ID:martin-helmich,项目名称:phpunit-psr7-assert,代码行数:8,代码来源:ConstraintTest.php


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