Ejemplo n.º 1
0
 /**
  * @depends writeModelClassWithManyToManyRelation
  * @depends writeAggregateRootClassesFromDomainObject
  *
  *
  * @test
  */
 function writeExtensionFiles()
 {
     $modelName = 'ModelCgt8';
     $relatedModelName = 'RelatedModel';
     $propertyName = 'relNames';
     $domainObject = $this->buildDomainObject($modelName, true, true);
     $relatedDomainObject = $this->buildDomainObject($relatedModelName, true);
     $relation = new Relation\ManyToManyRelation($propertyName);
     $relation->setForeignModel($relatedDomainObject);
     $relation->setInlineEditing(false);
     $domainObject->addProperty($relation);
     $property = new \EBT\ExtensionBuilder\Domain\Model\DomainObject\BooleanProperty('title');
     $domainObject->addProperty($property);
     $this->extension->addDomainObject($domainObject);
     $this->extension->addDomainObject($relatedDomainObject);
     $plugin = new Plugin();
     $plugin->setName('Test');
     $plugin->setKey('test');
     $this->extension->addPlugin($plugin);
     $this->fileGenerator->build($this->extension);
     $extensionDir = $this->extension->getExtensionDir();
     $extensionFiles = array('ext_emconf.php', 'ext_tables.php', 'ext_tables.sql', 'ext_localconf.php');
     foreach ($extensionFiles as $extensionFile) {
         $this->assertFileExists($extensionDir . $extensionFile, 'File was not generated: ' . $extensionFile);
     }
     $this->assertFileExists($extensionDir . 'Configuration/TCA/' . $domainObject->getDatabaseTableName() . '.php');
     $this->assertFileExists($extensionDir . 'Configuration/ExtensionBuilder/settings.yaml');
     $this->assertFileExists($extensionDir . 'Resources/Private/Language/locallang_db.xlf');
     $this->assertFileExists($extensionDir . 'Resources/Private/Language/locallang.xlf');
     $this->assertFileExists($extensionDir . 'Resources/Private/Partials/' . $domainObject->getName() . '/Properties.html');
     $this->assertFileExists($extensionDir . 'Resources/Private/Partials/' . $domainObject->getName() . '/FormFields.html');
 }
Ejemplo n.º 2
0
 /**
  * @param \EBT\ExtensionBuilder\Domain\Model\Plugin $plugin
  * @param \EBT\ExtensionBuilder\Domain\Model\Extension $extension
  * @return void
  */
 private function validatePluginConfiguration($plugin, $extension)
 {
     $controllerActionCombinationConfiguration = $plugin->getControllerActionCombinations();
     if (is_array($controllerActionCombinationConfiguration)) {
         $firstControllerAction = TRUE;
         foreach ($controllerActionCombinationConfiguration as $controllerName => $actionNames) {
             $this->validateActionConfiguration($controllerName, $actionNames, 'plugin ' . $plugin->getName(), $extension, $firstControllerAction);
             $firstControllerAction = FALSE;
         }
     }
     $noncachableActionConfiguration = $plugin->getNoncacheableControllerActions();
     if (is_array($noncachableActionConfiguration)) {
         foreach ($noncachableActionConfiguration as $controllerName => $actionNames) {
             $this->validateActionConfiguration($controllerName, $actionNames, 'plugin ' . $plugin->getName(), $extension);
         }
     }
     $switchableActionConfiguration = $plugin->getSwitchableControllerActions();
     if (is_array($switchableActionConfiguration)) {
         foreach ($switchableActionConfiguration as $switchableAction) {
             $configuredActions = array();
             foreach ($switchableAction['actions'] as $actions) {
                 // Format should be: Controller->action
                 list($controllerName, $actionName) = explode('->', $actions);
                 $configuredActions[] = $actionName;
                 GeneralUtility::devlog('Controller' . $controllerName, 'extension_builder', 0, array($actionName));
                 $this->validateActionConfiguration($controllerName, array($actionName), 'plugin ' . $plugin->getName(), $extension);
             }
             $this->validateDependentActions($configuredActions, 'plugin ' . $plugin->getName());
         }
     }
 }