예제 #1
0
 /**
  * @testdox Setting $tag->attributePreprocessors clears previous attributePreprocessors
  * @depends testAttributePreprocessorsArray
  */
 public function testAttributePreprocessorsArrayClears()
 {
     $attributePreprocessors = [['foo', '/a/'], ['foo', '/b/'], ['bar', '/c/']];
     $expected = new AttributePreprocessorCollection();
     $expected->add('foo', '/a/');
     $expected->add('foo', '/b/');
     $expected->add('bar', '/c/');
     $tag = new Tag();
     $tag->attributePreprocessors->add('baz', '/d/');
     $tag->attributePreprocessors = $attributePreprocessors;
     $this->assertEquals($expected->asConfig(), $tag->attributePreprocessors->asConfig());
 }
 /**
  * @testdox merge() accepts an instance of AttributePreprocessorCollection to copy its content
  */
 public function testMergeInstance()
 {
     $attributePreprocessors = ['foo' => ['/a/', '/b/'], 'bar' => ['/c/']];
     $collection1 = new AttributePreprocessorCollection();
     $collection2 = new AttributePreprocessorCollection();
     $collection1->add('foo', '/a/');
     $collection1->add('bar', '/b/');
     $collection2->merge($collection1);
     $this->assertEquals($collection1, $collection2);
 }