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


PHP PHPUnit_Framework_MockObject_MockObject::toArray方法代码示例

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


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

示例1: testDataFills

 public function testDataFills()
 {
     $fake = $this->generateFakeData();
     $instance = $this->rebuildTestInstance();
     $property = new \ReflectionProperty($instance, 'attributes');
     $property->setAccessible(true);
     $property->setValue($instance, ['name', 'name1', 'name2']);
     $property->setAccessible(false);
     foreach ($fake as $key => $value) {
         $instance->{$key} = $key === 'name2' ? new Collection() : null;
     }
     $instance->fill($fake);
     foreach ($fake as $key => $value) {
         if ($key !== 'name2') {
             $this->assertSame($fake[$key], $this->testInstance->{$key});
         } else {
             $this->assertTrue($this->testInstance->name2->count() === 3);
         }
     }
     $this->assertSame($fake, $this->testInstance->toArray());
     $this->assertSame($fake, $this->testInstance->toModel());
     $this->assertSame(json_encode($fake), $this->testInstance->toJson());
 }
开发者ID:laravel-commode,项目名称:viewmodel,代码行数:23,代码来源:BaseViewModelTest.php

示例2: toArrayReturnsArray

 /**
  * @test
  */
 public function toArrayReturnsArray()
 {
     $serviceId = 1;
     $name = 'name';
     $note = 'note';
     $status = 'status';
     $gross = 10.0;
     $net = 8.4;
     $taxClass = new \Extcode\Cart\Domain\Model\Order\TaxClass('normal', '19', 0.19);
     $tax = 1.6;
     $this->service->setServiceId($serviceId);
     $this->service->setName($name);
     $this->service->setStatus($status);
     $this->service->setNote($note);
     $this->service->setGross($gross);
     $this->service->setNet($net);
     $this->service->setTax($tax);
     $serviceArr = ['service_id' => $serviceId, 'name' => $name, 'status' => $status, 'net' => $net, 'gross' => $gross, 'tax' => $tax, 'taxClass' => null, 'note' => $note];
     $this->assertEquals($serviceArr, $this->service->toArray());
     //with taxClass
     $this->service->setTaxClass($taxClass);
     $serviceArr['taxClass'] = $taxClass->toArray();
     $this->assertEquals($serviceArr, $this->service->toArray());
 }
开发者ID:extcode,项目名称:cart,代码行数:27,代码来源:AbstractServiceTest.php

示例3: testToArrayFallback

 /**
  * @covers ::toArray
  *
  * @expectedException \Drupal\Core\Config\Schema\SchemaIncompleteException
  */
 public function testToArrayFallback()
 {
     $this->entity->toArray();
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:9,代码来源:ConfigEntityBaseUnitTest.php

示例4: testToArrayFallback

 /**
  * @covers ::toArray
  *
  * @expectedException \Drupal\Core\Config\Schema\SchemaIncompleteException
  */
 public function testToArrayFallback()
 {
     $this->entityType->expects($this->any())->method('getPropertiesToExport')->willReturn([]);
     $this->entity->toArray();
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:10,代码来源:ConfigEntityBaseUnitTest.php

示例5: toArrayReturnsEmptyArrayWithForEmptyQueue

 /**
  * @test
  */
 public function toArrayReturnsEmptyArrayWithForEmptyQueue()
 {
     $this->assertSame(array(), $this->flashMessageQueue->toArray());
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:7,代码来源:FlashMessageQueueTest.php


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