/**
  * @testdox asConfig() returns a list of [attrName, Regexp instance, map] arrays
  */
 public function testGetConfig()
 {
     $collection = new AttributePreprocessorCollection();
     $collection->add('x', '#(?<x1>x1)#');
     $collection->add('x', '#(?<x2>x2)#');
     $collection->add('y', '#(?<y1>y1)#');
     $collection->add('y', '#(?<y2>y2)#');
     $config = $collection->asConfig();
     ConfigHelper::filterVariants($config);
     $this->assertSame([['x', '#(?<x1>x1)#', ['', 'x1']], ['x', '#(?<x2>x2)#', ['', 'x2']], ['y', '#(?<y1>y1)#', ['', 'y1']], ['y', '#(?<y2>y2)#', ['', 'y2']]], $config);
 }
Exemple #2
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());
 }