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


PHP PHPUnit_Framework_Assert::isInstanceOf方法代码示例

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


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

示例1: 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

示例2: 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

示例3: isInstanceOf

/**
 * Returns a PHPUnit_Framework_Constraint_IsInstanceOf matcher object.
 *
 * @param  string $className
 * @return PHPUnit_Framework_Constraint_IsInstanceOf
 * @since  Method available since Release 3.0.0
 */
function isInstanceOf($className)
{
    return PHPUnit_Framework_Assert::isInstanceOf($className);
}
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:11,代码来源:Functions.php

示例4: testConstraintIsNotInstanceOf2

 /**
  * @covers PHPUnit_Framework_Constraint_IsInstanceOf
  * @covers PHPUnit_Framework_Constraint_Not
  * @covers PHPUnit_Framework_Assert::isInstanceOf
  * @covers PHPUnit_Framework_Assert::logicalNot
  */
 public function testConstraintIsNotInstanceOf2()
 {
     $constraint = PHPUnit_Framework_Assert::logicalNot(PHPUnit_Framework_Assert::isInstanceOf('stdClass'));
     try {
         $constraint->fail(new stdClass(), 'custom message', TRUE);
     } catch (PHPUnit_Framework_ExpectationFailedException $e) {
         $this->assertEquals("custom message\nFailed asserting that <stdClass> is not an instance of class \"stdClass\".", $e->getDescription());
         return;
     }
     $this->fail();
 }
开发者ID:kdambekalns,项目名称:framework-benchs,代码行数:17,代码来源:ConstraintTest.php

示例5: testConstraintIsNotInstanceOf2

    /**
     * @covers PHPUnit_Framework_Constraint_IsInstanceOf
     * @covers PHPUnit_Framework_Constraint_Not
     * @covers PHPUnit_Framework_Assert::isInstanceOf
     * @covers PHPUnit_Framework_Assert::logicalNot
     * @covers PHPUnit_Framework_TestFailure::exceptionToString
     */
    public function testConstraintIsNotInstanceOf2()
    {
        $constraint = PHPUnit_Framework_Assert::logicalNot(PHPUnit_Framework_Assert::isInstanceOf('stdClass'));
        try {
            $constraint->evaluate(new stdClass(), 'custom message');
        } catch (PHPUnit_Framework_ExpectationFailedException $e) {
            $this->assertEquals(<<<EOF
custom message
Failed asserting that stdClass Object () is not an instance of class "stdClass".

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

示例6: aSchlamiShowsUp

 /**
  * @Then a schlami shows up
  */
 public function aSchlamiShowsUp()
 {
     $this->_schlami = new Schlami();
     Assert::isInstanceOf(Schlami::class, $this->_schlami);
 }
开发者ID:remotelyliving,项目名称:plumbus-php,代码行数:8,代码来源:PlumbusContext.php


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