public function testShouldUseFactoryToCreateRecords() { $data = array('foo' => true); $record = new Record($data); $factory = $this->getMockBuilder('PHPFluent\\ArrayStorage\\Factory')->disableOriginalConstructor()->getMock(); $factory->expects($this->once())->method('record')->with($data)->will($this->returnValue($record)); $collection = new Collection($factory); $this->assertSame($record, $collection->record($data)); }