Example #1
0
 public function testBufferCopy2()
 {
     $buffer1 = new Opt_Xml_Root();
     $buffer1->addAfter(Opt_Xml_Buffer::TAG_BEFORE, 'foo');
     $buffer1->addAfter(Opt_Xml_Buffer::TAG_BEFORE, 'bar');
     $buffer2 = new Opt_Xml_Root();
     $buffer2->addAfter(Opt_Xml_Buffer::TAG_BEFORE, 'joe');
     $buffer2->copyBuffer($buffer1, Opt_Xml_Buffer::TAG_BEFORE, Opt_Xml_Buffer::TAG_BEFORE);
     $property = new ReflectionProperty('Opt_Xml_Buffer', '_buffers');
     $property->setAccessible(true);
     $value = $property->getValue($buffer2);
     if (is_array($value) && is_array($value[Opt_Xml_Buffer::TAG_BEFORE]) && $value[Opt_Xml_Buffer::TAG_BEFORE][0] == 'foo' && $value[Opt_Xml_Buffer::TAG_BEFORE][1] == 'bar' && $value[Opt_Xml_Buffer::TAG_BEFORE][2] == 'joe') {
         return true;
     }
     echo "testBufferCopy list:\r\n";
     var_dump($value);
     $this->fail('The copied values have not been added before the existing values.');
 }