importString() public method

Import a string a bytes into this CharacterStream, overwriting any existing data in the stream.
public importString ( string $string )
$string string
 public function testAlgorithmWithFixedWidthCharsets()
 {
     $reader = $this->_getReader();
     $factory = $this->_getFactory($reader);
     $seq = $this->_mockery()->sequence('read-chars');
     $this->_checking(Expectations::create()->ignoring($reader)->getInitialByteSize()->returns(2)->one($reader)->validateByteSequence(array(0xd1, 0x8d), 2)->inSequence($seq)->one($reader)->validateByteSequence(array(0xd0, 0xbb), 2)->inSequence($seq)->one($reader)->validateByteSequence(array(0xd0, 0xb0), 2)->inSequence($seq));
     $stream = new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8');
     $stream->importString(pack('C*', 0xd1, 0x8d, 0xd0, 0xbb, 0xd0, 0xb0));
     $this->assertIdenticalBinary(pack('C*', 0xd1, 0x8d), $stream->read(1));
     $this->assertIdenticalBinary(pack('C*', 0xd0, 0xbb), $stream->read(1));
     $this->assertIdenticalBinary(pack('C*', 0xd0, 0xb0), $stream->read(1));
     $this->assertIdentical(false, $stream->read(1));
 }
 public function testAlgorithmWithFixedWidthCharsets()
 {
     $reader = $this->_getReader();
     $factory = $this->_getFactory($reader);
     $reader->shouldReceive('getInitialByteSize')->zeroOrMoreTimes()->andReturn(2);
     $reader->shouldReceive('validateByteSequence')->once()->with(array(0xd1, 0x8d), 2);
     $reader->shouldReceive('validateByteSequence')->once()->with(array(0xd0, 0xbb), 2);
     $reader->shouldReceive('validateByteSequence')->once()->with(array(0xd0, 0xb0), 2);
     $stream = new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8');
     $stream->importString(pack('C*', 0xd1, 0x8d, 0xd0, 0xbb, 0xd0, 0xb0));
     $this->assertIdenticalBinary(pack('C*', 0xd1, 0x8d), $stream->read(1));
     $this->assertIdenticalBinary(pack('C*', 0xd0, 0xbb), $stream->read(1));
     $this->assertIdenticalBinary(pack('C*', 0xd0, 0xb0), $stream->read(1));
     $this->assertSame(false, $stream->read(1));
 }