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


PHP PHPUnit_Framework_TestCase::assertNotContains方法代码示例

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


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

示例1: assertNotContains

 /**
  * @param mixed|CM_Comparable $needle
  * @param mixed|Traversable   $haystack
  * @param string              $message
  * @param boolean             $ignoreCase
  * @param boolean             $checkForObjectIdentity
  * @param bool                $checkForNonObjectIdentity
  * @throws CM_Exception_Invalid
  */
 public static function assertNotContains($needle, $haystack, $message = '', $ignoreCase = false, $checkForObjectIdentity = true, $checkForNonObjectIdentity = false)
 {
     if ($needle instanceof CM_Comparable) {
         if (!(is_array($haystack) || $haystack instanceof Traversable)) {
             throw new CM_Exception_Invalid('Haystack is not traversable.');
         }
         $match = false;
         foreach ($haystack as $hay) {
             if ($needle->equals($hay)) {
                 $match = true;
                 break;
             }
         }
         self::assertFalse($match, 'Needle contained.');
     } else {
         parent::assertNotContains($needle, $haystack, $message, $ignoreCase, $checkForObjectIdentity, $checkForNonObjectIdentity);
     }
 }
开发者ID:NicolasSchmutz,项目名称:cm,代码行数:27,代码来源:TestCase.php

示例2: assertPropertyCollection

 /**
  * @param object $instance
  * @param string $propertyName
  * @param mixed $testItem
  */
 public static function assertPropertyCollection($instance, $propertyName, $testItem)
 {
     $propertyAccess = new CollectionAccessor($instance, $propertyName);
     // Check default value
     \PHPUnit_Framework_TestCase::assertInstanceOf('Doctrine\\Common\\Collections\\Collection', $propertyAccess->getItems(), $propertyName . ': Default value must be instance of Collection');
     // Check default size
     \PHPUnit_Framework_TestCase::assertCount(0, $propertyAccess->getItems(), $propertyName . ': Default collection size must be 0');
     // Add first item
     \PHPUnit_Framework_TestCase::assertSame($instance, $propertyAccess->addItem($testItem), sprintf('%s::%s() - must return %s', ClassUtils::getClass($instance), $propertyAccess->getAddItemMethod(), ClassUtils::getClass($instance)));
     // Check added item
     \PHPUnit_Framework_TestCase::assertCount(1, $propertyAccess->getItems(), $propertyName . ': After add item - collection size must be 1');
     \PHPUnit_Framework_TestCase::assertInstanceOf('Doctrine\\Common\\Collections\\Collection', $propertyAccess->getItems(), $propertyName . ': After addition of a first item - property value must be instance of Collection');
     \PHPUnit_Framework_TestCase::assertEquals([$testItem], $propertyAccess->getItems()->toArray(), $propertyName . ': After addition of a first item - collections must be equals');
     // Add already added item
     $propertyAccess->addItem($testItem);
     \PHPUnit_Framework_TestCase::assertCount(1, $propertyAccess->getItems(), $propertyName . ': After addition already added item - collection size must be same and equal 1');
     // Remove item
     \PHPUnit_Framework_TestCase::assertSame($instance, $propertyAccess->removeItem($testItem), sprintf('%s:%s() - must return %s', ClassUtils::getClass($instance), $propertyAccess->getRemoveItemMethod(), ClassUtils::getClass($instance)));
     \PHPUnit_Framework_TestCase::assertCount(0, $propertyAccess->getItems(), $propertyName . ': After removal of a single item - collection size must be 0');
     // Remove already removed item
     $propertyAccess->removeItem($testItem);
     \PHPUnit_Framework_TestCase::assertCount(0, $propertyAccess->getItems(), $propertyName . ': After removal already removed item - collection size must be same and equal 0');
     \PHPUnit_Framework_TestCase::assertNotContains($testItem, $propertyAccess->getItems()->toArray(), $propertyName . ': After removal of a single item - collection must not contains test item');
 }
开发者ID:adam-paterson,项目名称:orocommerce,代码行数:29,代码来源:EntityTestCaseTrait.php

示例3: assertNotContains

 public static function assertNotContains($needle, $haystack, $message = '', $ignoreCase = FALSE, $checkForObjectIdentity = TRUE, $checkForNonObjectIdentity = false)
 {
     if ($haystack instanceof DBField) {
         $haystack = (string) $haystack;
     }
     parent::assertNotContains($needle, $haystack, $message, $ignoreCase, $checkForObjectIdentity, $checkForNonObjectIdentity);
 }
开发者ID:congaaids,项目名称:silverstripe-framework,代码行数:7,代码来源:SapphireTest.php

示例4: testRemove

 public function testRemove($data)
 {
     $count = count($this->entityGet());
     $countBeforeRemove = $this->countDataInCollection($data);
     $returnOfRemoveMethod = $this->entityRemove($data);
     if ($this->fluent) {
         TestCase::assertEquals($this->entity, $this->entityRemove($data), $this->msg(self::$MSG_REMOVE_METHOD_NOT_FLUENT));
     }
     TestCase::assertNotContains($data, $this->entityGet(), $this->msg(self::$MSG_REMOVE_METHOD_DOES_NOT_REMOVE));
     TestCase::assertCount($count - $countBeforeRemove, $this->entityGet(), $this->msg(self::$MSG_REMOVE_METHOD_DOES_NOT_REMOVE_GOOD_NUMBER_OF_ITEMS));
     return $this;
 }
开发者ID:jngermon,项目名称:phpunit-entity-tester,代码行数:12,代码来源:AccessorCollectionTester.php


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