/** * Test a simple read. * * @covers \Binary\Field\Text::read */ public function testSimpleRead() { $field = new Text(); $field->setSize($this->getMockedProperty(4)); $field->setName('foo'); $stream = $this->getMockedStringStream('barr'); $dataSet = $this->getMock('\\Binary\\DataSet'); $dataSet->expects($this->once())->method('setValue')->with($this->equalTo('foo'), $this->equalTo('barr')); $field->read($stream, $dataSet); }
public function testSimpleRead() { $field = new Text(); $property = $this->getMockBuilder('\\Binary\\Field\\Property\\PropertyInterface')->getMock(); $property->expects($this->any())->method('get')->will($this->returnValue(4)); $field->setSize($property); $field->setName('foo'); $stream = $this->getMock('\\Binary\\Stream\\StreamInterface'); $stream->expects($this->any())->method('read')->will($this->returnValue('barr')); $dataSet = $this->getMock('\\Binary\\DataSet'); $dataSet->expects($this->once())->method('setValue')->with($this->equalTo('foo'), $this->equalTo('barr')); $field->read($stream, $dataSet); }