public function testSort()
 {
     $context = new Context();
     $context->addDirs(Yii::getAlias('@tests/controllers'));
     $context->sortControllers('shortDescription');
     $controllers = $context->getControllers();
     $this->assertEquals(['brand', 'new-brand', 'product'], array_keys($controllers));
 }
 /**
  * Run builder.
  */
 public function actionRun()
 {
     $context = new Context();
     if ($this->sourceDirs) {
         $context->addDirs($this->sourceDirs);
     }
     if ($this->sourceModules) {
         $context->addModules($this->sourceModules);
     }
     if ($this->sortProperty) {
         $context->sortControllers($this->sortProperty);
     }
     $result = $this->renderPartial(Yii::getAlias($this->template), ['controllers' => $context->controllers]);
     if ($this->targetFile) {
         file_put_contents(Yii::getAlias($this->targetFile), $result);
     } else {
         echo $result;
     }
 }