/**
  * @When /^I configure the Auja Configurator$/
  */
 public function iConfigureTheAujaConfigurator()
 {
     /* We still need to configure pivot tables that don't exist */
     for ($i = 0; $i < sizeof($this->models); $i++) {
         $model = $this->models[$i];
         for ($j = $i + 1; $j < sizeof($this->models); $j++) {
             $otherModel = $this->models[$j];
             $this->databaseHelper->shouldReceive('hasTable')->with(sprintf('%s_%s', strtolower($otherModel), strtolower($model)))->andReturn(false);
             $this->databaseHelper->shouldReceive('hasTable')->with(sprintf('%s_%s', strtolower($model), strtolower($otherModel)))->andReturn(false);
         }
     }
     $this->aujaConfigurator->configure($this->models);
 }
예제 #2
0
 /**
  * Creates a new Auja instance.
  *
  * @param Application $app The Illuminate Application instance.
  * @param AujaConfigurator $aujaConfigurator
  * @param [] $models The model configuration.
  */
 function __construct(Application $app, AujaConfigurator $aujaConfigurator, array $modelNames)
 {
     if (php_sapi_name() == 'cli') {
         /* Don't run when we're running artisan commands. */
         return;
     }
     if (empty($modelNames)) {
         throw new \InvalidArgumentException('Provide models for Auja to manage');
     }
     $this->app = $app;
     Log::debug('Initializing Auja with models:', $modelNames);
     $this->aujaConfigurator = $aujaConfigurator;
     $this->aujaConfigurator->configure($modelNames);
 }