Exemple #1
0
 public function testPostprocessors()
 {
     $m = new PluginManager($this->getParserMock());
     $r = $m->addPostProcessor($postprocessor1 = new myTestPostProcessor('first'));
     $this->assertInstanceOf('ILess\\PluginManager', $r, 'fluent interface works');
     $postprocessors = $m->getPostProcessors();
     $this->assertEquals([$postprocessor1], $postprocessors, 'getPostProcessors returns an array of postprocessors');
     // add second but with higher priority
     $m->addPostProcessor($postprocessor2 = new myTestPostProcessor('second'), 200);
     $postprocessors = $m->getPostProcessors();
     $this->assertEquals([$postprocessor2, $postprocessor1], $postprocessors, 'getPostProcessors returns an array of postprocessors');
 }
Exemple #2
0
 /**
  * Returns an array of post compilation visitors.
  *
  * @return array
  */
 protected function getPostCompileVisitors()
 {
     // core visitors
     $postCompileVisitors = [new JoinSelectorVisitor(), new ProcessExtendsVisitor()];
     if ($this->pluginManager) {
         $postCompileVisitors = array_merge($this->pluginManager->getPostCompileVisitors(), $postCompileVisitors);
     }
     $postCompileVisitors[] = new ToCSSVisitor($this->getContext());
     return $postCompileVisitors;
 }