Skip to content

Commit

Permalink
BAP-21548: Boilerplate code generation (#32837)
Browse files Browse the repository at this point in the history
Implemented initial code generation based on provided configuration for:
- Bundle
- Doctrine Entities
- Validation Configuration
- Translations
- Data Grids
- Configure Search
- Add ACLs
- Form Types
- CreateOrSelect form types with select grid
- Controllers (CRUD)
- Ability to add toMany relation with UI
- Actions (actions.yml)
- Navigation
- API
- Import Export
- Import Export of collections
  • Loading branch information
x86demon authored Nov 1, 2022
1 parent af14e39 commit 24d2705
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Yaml\Parser as YamlParser;

/**
Expand Down Expand Up @@ -37,6 +38,18 @@ public function process(ContainerBuilder $container): void
$this->registerJobs($registry, $configFile);
}
}

// Temporary solution, should be refactored loaded in BAP-21714
$path = $container->getParameter('kernel.project_dir') . '/config/batch_jobs';
if (is_dir($path)) {
$finder = new Finder();
$finder->in($path)->files()->name('*.yml')->name('*.yaml');
foreach ($finder as $item) {
$filePath = $item->getRealPath();
$container->addResource(new FileResource($filePath));
$this->registerJobs($registry, $filePath);
}
}
}

private function registerJobs(Definition $definition, string $configFile): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -815,15 +815,17 @@ public function assertRowValues($content, TableNode $table, $gridName = null)
}
}

//@codingStandardsIgnoreStart
/**
* Assert record position in grid
* It is find record by text and assert its position
* Example: Then Zyta Zywiec must be first record
* Example: And John Doe must be first record
*
* @Then /^(?P<content>[\w\d\s]+) must be (?P<rowNumber>(?:|first|second|[\d]+)) record$/
* @Then /^(?P<content>[\w\d\s]+) must be (?P<rowNumber>(?:|first|second|[\d]+)) record in "(?P<gridName>[^"]+)"$/
* @Then /^(?P<content>[\w\d\s\-\.,%]+) must be (?P<rowNumber>(?:|first|second|[\d]+)) record$/
* @Then /^(?P<content>[\w\d\s\-\.,%]+) must be (?P<rowNumber>(?:|first|second|[\d]+)) record in "(?P<gridName>[^"]+)"$/
*/
//@codingStandardsIgnoreEnd
public function assertRowContent($content, $rowNumber, $gridName = null)
{
$grid = $this->getGrid($gridName);
Expand Down
13 changes: 13 additions & 0 deletions src/Oro/Bundle/FormBundle/Tests/Behat/Context/FormContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,19 @@ public function iOpenSelectEntityPopup($fieldName, $formName = "OroForm")
$field->openSelectEntityPopup();
}

//@codingStandardsIgnoreStart
/**
* @When /^(?:|I )open create entity popup for field "(?P<fieldName>[\w\s]*)" in form "(?P<formName>(?:[^"]|\\")*)"$/
* @When /^(?:|I )open create entity popup for field "(?P<fieldName>[\w\s]*)"$/
*/
//@codingStandardsIgnoreEnd
public function iOpenCreateEntityPopup($fieldName, $formName = "OroForm")
{
/** @var Select2Entity $field */
$field = $this->getFieldInForm($fieldName, $formName);
$field->openCreateEntityPopup();
}

/**
* @When /^(?:|I )clear "(?P<fieldName>[\w\s]*)" field in form "(?P<formName>(?:[^"]|\\")*)"$/
* @When /^(?:|I )clear "(?P<fieldName>[\w\s]*)" field$/
Expand Down
34 changes: 34 additions & 0 deletions src/Oro/Bundle/FormBundle/Tests/Behat/Element/Select2Entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,40 @@ function (UiDialog $dialog) {
return null;
}

/**
* @param bool $force
* @return UiDialog
*/
public function openCreateEntityPopup($force = false)
{
$entitySelect = $this->getParent()->getParent();
$entityCreateButton = $entitySelect->find('css', '.entity-create-btn');
$this->spin(function () use ($entitySelect) {
return $entitySelect->find('css', '.select2-container');
}, 10);
$entityCreateButton->focus();
if ($entityCreateButton->isVisible()) {
if ($force) {
$this->getDriver()->executeJsOnXpath($entityCreateButton->getXpath(), '{{ELEMENT}}.click()');
} else {
$entityCreateButton->click();
}
$this->getDriver()->waitForAjax();

$dialogs = array_filter(
$this->elementFactory->findAllElements('UiDialog'),
function (UiDialog $dialog) {
return $dialog->isValid() && $dialog->isVisible();
}
);
if ($dialogs) {
return end($dialogs);
}
}

return null;
}

public function clear()
{
$close = $this->getParent()->find('css', '.select2-search-choice-close');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1288,6 +1288,7 @@ public function scrollBottom()
*/
public function pressButtonInModalWindow($button)
{
/** @var NodeElement $modalWindow */
$modalWindow = $this->spin(function () {
return $this->getPage()->findVisible('css', 'div.modal, div[role="dialog"]');
}, 5);
Expand Down

0 comments on commit 24d2705

Please sign in to comment.