本文整理汇总了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());
}
示例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());
}
示例3: testToArrayFallback
/**
* @covers ::toArray
*
* @expectedException \Drupal\Core\Config\Schema\SchemaIncompleteException
*/
public function testToArrayFallback()
{
$this->entity->toArray();
}
示例4: testToArrayFallback
/**
* @covers ::toArray
*
* @expectedException \Drupal\Core\Config\Schema\SchemaIncompleteException
*/
public function testToArrayFallback()
{
$this->entityType->expects($this->any())->method('getPropertiesToExport')->willReturn([]);
$this->entity->toArray();
}
示例5: toArrayReturnsEmptyArrayWithForEmptyQueue
/**
* @test
*/
public function toArrayReturnsEmptyArrayWithForEmptyQueue()
{
$this->assertSame(array(), $this->flashMessageQueue->toArray());
}