public function testContentsCanBeFlushed() { $reader = $this->_getReader(); $factory = $this->_getFactory($reader); $stream = new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8'); $seq = $this->_mockery()->sequence('read-sequence'); $this->_checking(Expectations::create()->ignoring($reader)->getInitialByteSize()->returns(1)->one($reader)->validateByteSequence(array(0xd0), 1)->inSequence($seq)->returns(1)->one($reader)->validateByteSequence(array(0xd0), 1)->inSequence($seq)->returns(1)->one($reader)->validateByteSequence(array(0xd0), 1)->inSequence($seq)->returns(1)); $stream->importString(pack('C*', 0xd0, 0x94, 0xd0, 0xb6, 0xd0, 0xbe)); $stream->flushContents(); $this->assertIdentical(false, $stream->read(1)); }
public function testContentsCanBeFlushed() { $reader = $this->_getReader(); $factory = $this->_getFactory($reader); $stream = new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8'); $reader->shouldReceive('getInitialByteSize')->zeroOrMoreTimes()->andReturn(1); $reader->shouldReceive('validateByteSequence')->once()->with(array(0xd0), 1)->andReturn(1); $reader->shouldReceive('validateByteSequence')->once()->with(array(0xd0), 1)->andReturn(1); $reader->shouldReceive('validateByteSequence')->once()->with(array(0xd0), 1)->andReturn(1); $stream->importString(pack('C*', 0xd0, 0x94, 0xd0, 0xb6, 0xd0, 0xbe)); $stream->flushContents(); $this->assertSame(false, $stream->read(1)); }