/**
  * @testdox Only executes a normalization once per run if its "onlyOnce" property is true
  */
 public function testOnlyOnce()
 {
     $templateNormalizer = new TemplateNormalizer();
     $templateNormalizer->append(new DummyNormalization('?'));
     $templateNormalizer->append(new DummyNormalization('!'))->onlyOnce = true;
     $this->assertSame('Hi?!????', $templateNormalizer->normalizeTemplate('Hi'));
 }
Ejemplo n.º 2
0
 /**
  * Constructor
  *
  * @return void
  */
 public function __construct()
 {
     $this->normalizer = new TemplateNormalizer();
     $this->normalizer->clear();
     $this->normalizer->append('MergeConsecutiveCopyOf');
     $this->normalizer->append('MergeIdenticalConditionalBranches');
     $this->normalizer->append('OptimizeNestedConditionals');
 }