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


PHP PHPUnit_Framework_TestCase::assertSame方法代码示例

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


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

示例1: assertOnlyDeprecatedErrors

 public function assertOnlyDeprecatedErrors(array $deprecationMessages)
 {
     $this->testCase->assertSame(count($deprecationMessages), $this->getCount());
     $this->testCase->assertSame(count($deprecationMessages), $this->getDeprecatedCount());
     foreach ($deprecationMessages as $index => $message) {
         $this->testCase->assertSame($message, $this->getMessage($index));
     }
 }
开发者ID:makeandship,项目名称:wordpress-fantastic-elasticsearch,代码行数:8,代码来源:ErrorsCollector.php

示例2: getFormattedMessage

 /**
  * @test
  */
 public function getFormattedMessage()
 {
     $formatter = $this->getFormatterMock();
     $record = $this->getRecordMock();
     $formatter->expects(parent::once())->method('format')->with($record)->willReturn('foobar');
     $this->formatterContainer->setFormatter($formatter);
     parent::assertSame('foobar', $this->formatterContainer->getFormattedMessage($record));
 }
开发者ID:oqq,项目名称:minc-log,代码行数:11,代码来源:FormatterContainerTest.php

示例3: getValues

 /**
  * @param array $values
  * @param array $expected
  *
  * @test
  * @dataProvider getInstanceValues
  */
 public function getValues(array $values, $expected)
 {
     $collection = $this->getCollectionInstance($values);
     foreach ($expected as $key => $value) {
         parent::assertSame($value, $collection->get($key));
         parent::assertSame($value, $collection->{$key});
     }
 }
开发者ID:oqq,项目名称:minc-common,代码行数:15,代码来源:AbstractCollectionTestCase.php

示例4: assertErrorMessages

 public static function assertErrorMessages(TestCase $testCase, FormErrorSequence $formErrorSequence, array $expectedMessages)
 {
     $actualMessages = [];
     foreach ($formErrorSequence as $formError) {
         $actualMessages[$formError->getKey()] = $formError->getMessage();
     }
     $testCase->assertSame($expectedMessages, $actualMessages);
 }
开发者ID:dasprid,项目名称:formidable,代码行数:8,代码来源:FormErrorAssertion.php

示例5: assertErrorMessages

 public static function assertErrorMessages(TestCase $testCase, ValidationResult $validationResult, array $expectedMessages)
 {
     $actualMessages = [];
     foreach ($validationResult->getValidationErrors() as $validationError) {
         $actualMessages[$validationError->getMessage()] = $validationError->getArguments();
     }
     $testCase->assertSame($expectedMessages, $actualMessages);
 }
开发者ID:dasprid,项目名称:formidable,代码行数:8,代码来源:ValidationErrorAssertion.php

示例6: pushProcessors

 /**
  * @test
  */
 public function pushProcessors()
 {
     $processors = [$this->getProcessorMock(), $this->getProcessorMock()];
     foreach ($processors as $processor) {
         $this->processorContainer->pushProcessor($processor);
     }
     foreach ($this->processorContainer->getProcessors() as $x => $processor) {
         parent::assertSame($processors[$x], $processor);
     }
 }
开发者ID:oqq,项目名称:minc-log,代码行数:13,代码来源:ProcessorContainerTest.php

示例7: pushHandler

 /**
  * @test
  */
 public function pushHandler()
 {
     $handlers = [$this->getHandlerMock(), $this->getHandlerMock()];
     foreach ($handlers as $handler) {
         $this->handlerContainer->pushHandler($handler);
     }
     foreach ($this->handlerContainer->getHandlers() as $x => $handler) {
         parent::assertSame($handlers[$x], $handler);
     }
 }
开发者ID:oqq,项目名称:minc-log,代码行数:13,代码来源:HandlerContainerTest.php

示例8: testCallableChangeToConsistency

 public function testCallableChangeToConsistency()
 {
     $this->connection->callableConsistency(\CouchbaseN1qlQuery::REQUEST_PLUS, function (\Ytake\LaravelCouchbase\Database\CouchbaseConnection $con) {
         \Closure::bind(function () {
             PHPUnit_Framework_TestCase::assertSame(\CouchbaseN1qlQuery::REQUEST_PLUS, $this->consistency);
         }, $con, get_class($con))->__invoke();
     });
     \Closure::bind(function () {
         PHPUnit_Framework_TestCase::assertSame(\CouchbaseN1qlQuery::NOT_BOUNDED, $this->consistency);
     }, $this->connection, get_class($this->connection))->__invoke();
 }
开发者ID:ytake,项目名称:laravel-couchbase,代码行数:11,代码来源:DatabaseTest.php

示例9: recursiveRecursiveGenerator

 /**
  * @test
  */
 public function recursiveRecursiveGenerator()
 {
     $rounds = 5;
     $increment = 5;
     $modulus = $rounds * $increment;
     $generator = $this->getRecursiveRecursiveGenerator($rounds, $increment);
     $recursiveIterator = new \RecursiveIteratorIterator(new RecursiveGeneratorIterator($generator));
     $i = 0;
     foreach ($recursiveIterator as $key => $value) {
         parent::assertSame($i % $modulus, $key);
         parent::assertSame($i % $modulus, $value);
         $i++;
     }
     parent::assertSame($rounds * $modulus, $i);
 }
开发者ID:oqq,项目名称:minc-common,代码行数:18,代码来源:RecursiveGeneratorIteratorTest.php

示例10: testStripcslashes

 public function testStripcslashes()
 {
     $t = new \Test\Strings();
     parent::assertSame(stripcslashes('\\abcd\\e\\f\\g\\h\\i\\j\\k\\l\\m\\n\\o\\pqrstuvwxy\\z'), $t->testStripcslashes('\\abcd\\e\\f\\g\\h\\i\\j\\k\\l\\m\\n\\o\\pqrstuvwxy\\z'));
     parent::assertSame(stripcslashes('\\065\\x64'), $t->testStripcslashes('\\065\\x64'));
     parent::assertSame(stripcslashes(''), $t->testStripcslashes(''));
 }
开发者ID:phalcon,项目名称:zephir,代码行数:7,代码来源:StringTest.php

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

示例12: assertIdentical

 /**
  * @deprecated since 2.3
  * @static
  * @param mixed $expected
  * @param mixed $actual
  * @param string $message
  * @return void
  */
 public static function assertIdentical($expected, $actual, $message = '')
 {
     parent::assertSame($expected, $actual, $message);
 }
开发者ID:numbas,项目名称:moodle,代码行数:12,代码来源:lib.php

示例13: hasBody

 /**
  * @param string $body
  *
  * @return ResponseAssertion
  */
 public function hasBody($body)
 {
     $this->testCase->assertSame($body, (string) $this->response->getBody());
     return $this;
 }
开发者ID:brick,项目名称:app,代码行数:10,代码来源:ResponseAssertion.php

示例14: toStringMethod

 /**
  * @test
  */
 public function toStringMethod()
 {
     $level = new Level();
     parent::assertSame((string) $level, sprintf('%s (%s)', $level->getName(), $level->getValue()));
 }
开发者ID:oqq,项目名称:minc-log,代码行数:8,代码来源:LevelTest.php

示例15: assertValueObjectHasValue

 /**
  * Helper method that checks a value object's value.
  *
  * @param VO $instance
  * @param string $checkedValue
  * @param string $attributeName
  */
 public static function assertValueObjectHasValue(VO $instance, $checkedValue, $attributeName = 'value')
 {
     $value = \PHPUnit_Framework_Assert::readAttribute($instance, $attributeName);
     \PHPUnit_Framework_TestCase::assertSame($checkedValue, $value);
 }
开发者ID:bogdananton,项目名称:mysql-structure-inspect,代码行数:12,代码来源:TestHelper.php


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