This repository has been archived by the owner on Nov 16, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
468 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env sh | ||
set -ev | ||
|
||
features/Fixtures/Project/bin/console --no-interaction cache:clear --env=test | ||
features/Fixtures/Project/bin/console doctrine:schema:update --force --env=test | ||
features/Fixtures/Project/bin/console assets:install | ||
nohup php -S 127.0.0.1:8000 -t features/Fixtures/Project/public 2>&1 & | ||
vendor/bin/behat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
default: | ||
suites: | ||
default: | ||
contexts: | ||
- KunicMarko\SonataAutoConfigureBundle\Features\Context\AdminContext: | ||
entityManager: '@doctrine.orm.entity_manager' | ||
|
||
extensions: | ||
Behat\MinkExtension: | ||
base_url: 'http://127.0.0.1:8000/' | ||
goutte: ~ | ||
selenium2: ~ | ||
Behat\Symfony2Extension: | ||
kernel: | ||
env: test | ||
debug: true | ||
path: features/Fixtures/Project/src/Kernel.php | ||
class: KunicMarko\SonataAutoConfigureBundle\Features\Fixtures\Project\Kernel | ||
bootstrap: tests/bootstrap.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?php | ||
|
||
namespace KunicMarko\SonataAutoConfigureBundle\Features\Context; | ||
|
||
use Behat\MinkExtension\Context\MinkContext; | ||
use Doctrine\Common\DataFixtures\Executor\ORMExecutor; | ||
use Doctrine\Common\DataFixtures\Purger\ORMPurger; | ||
use Doctrine\ORM\EntityManagerInterface; | ||
use Behat\Symfony2Extension\Context\KernelDictionary; | ||
use KunicMarko\SonataAutoConfigureBundle\Features\Fixtures\CategoryFixtures; | ||
use Doctrine\Common\DataFixtures\Loader; | ||
|
||
class AdminContext extends MinkContext | ||
{ | ||
use KernelDictionary; | ||
|
||
/** | ||
* @var EntityManagerInterface | ||
*/ | ||
private $entityManager; | ||
|
||
public function __construct(EntityManagerInterface $entityManager) | ||
{ | ||
$this->entityManager = $entityManager; | ||
} | ||
|
||
/** | ||
* @BeforeScenario | ||
*/ | ||
public function clearData(): void | ||
{ | ||
$this->getPurger()->purge(); | ||
} | ||
|
||
private function getPurger(): ORMPurger | ||
{ | ||
return new ORMPurger($this->entityManager); | ||
} | ||
|
||
/** | ||
* @Given I am on the dashboard | ||
*/ | ||
public function iAmOnTheDashboard(): void | ||
{ | ||
$this->visitPath('/admin/dashboard'); | ||
} | ||
|
||
/** | ||
* @Given I have items in the database | ||
*/ | ||
public function iHaveItemsInTheDatabase(): void | ||
{ | ||
$loader = new Loader(); | ||
$loader->addFixture(new CategoryFixtures()); | ||
|
||
$executor = new ORMExecutor($this->entityManager, $this->getPurger()); | ||
$executor->execute($loader->getFixtures()); | ||
} | ||
|
||
/** | ||
* @Then I should see :button button | ||
*/ | ||
public function iShouldSeeAButton(string $button): void | ||
{ | ||
$this->getSession()->getPage()->find('xpath', "//a[contains(text(), $button)]"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace KunicMarko\SonataAutoConfigureBundle\Features\Fixtures; | ||
|
||
use KunicMarko\SonataAutoConfigureBundle\Features\Fixtures\Project\Entity\Category; | ||
use Doctrine\Bundle\FixturesBundle\Fixture; | ||
use Doctrine\Common\Persistence\ObjectManager; | ||
|
||
class CategoryFixtures extends Fixture | ||
{ | ||
public function load(ObjectManager $manager) | ||
{ | ||
$category = new Category('Dummy Category'); | ||
|
||
$manager->persist($category); | ||
$manager->flush(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
###> symfony/framework-bundle ### | ||
/.env | ||
/public/bundles/ | ||
/var/ | ||
/vendor/ | ||
###< symfony/framework-bundle ### | ||
|
||
###> symfony/web-server-bundle ### | ||
/.web-server-pid | ||
###< symfony/web-server-bundle ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
use KunicMarko\SonataAutoConfigureBundle\Features\Fixtures\Project\Kernel; | ||
use Symfony\Bundle\FrameworkBundle\Console\Application; | ||
use Symfony\Component\Console\Input\ArgvInput; | ||
|
||
set_time_limit(0); | ||
|
||
require __DIR__.'../../../../../vendor/autoload.php'; | ||
|
||
umask(0000); | ||
|
||
$input = new ArgvInput(); | ||
$kernel = new Kernel('test', true); | ||
$application = new Application($kernel); | ||
$application->run($input); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
return [ | ||
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], | ||
Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle::class => ['all' => true], | ||
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], | ||
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true], | ||
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], | ||
Sonata\DatagridBundle\SonataDatagridBundle::class => ['all' => true], | ||
Sonata\CoreBundle\SonataCoreBundle::class => ['all' => true], | ||
Sonata\BlockBundle\SonataBlockBundle::class => ['all' => true], | ||
Knp\Bundle\MenuBundle\KnpMenuBundle::class => ['all' => true], | ||
Sonata\AdminBundle\SonataAdminBundle::class => ['all' => true], | ||
Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle::class => ['all' => true], | ||
KunicMarko\SonataAutoConfigureBundle\SonataAutoConfigureBundle::class => ['all' => true], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
doctrine: | ||
dbal: | ||
driver: 'pdo_mysql' | ||
server_version: '5.7' | ||
charset: utf8mb4 | ||
default_table_options: | ||
charset: utf8mb4 | ||
collate: utf8mb4_unicode_ci | ||
|
||
url: 'sqlite:///%kernel.project_dir%/var/cache/app.db' | ||
orm: | ||
auto_generate_proxy_classes: '%kernel.debug%' | ||
naming_strategy: doctrine.orm.naming_strategy.underscore | ||
auto_mapping: true | ||
mappings: | ||
SonataAutoConfigureBundle: | ||
is_bundle: false | ||
type: annotation | ||
dir: '%kernel.project_dir%/src/Entity' | ||
prefix: 'KunicMarko\SonataAutoConfigureBundle\Features\Fixtures\Project\Entity' | ||
alias: SonataAutoConfigureBundle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
framework: | ||
secret: '%env(APP_SECRET)%' | ||
test: true | ||
session: | ||
storage_id: session.storage.mock_file | ||
php_errors: | ||
log: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
framework: | ||
router: | ||
strict_requirements: ~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
security: | ||
providers: | ||
in_memory: {memory: ~} | ||
firewalls: | ||
dev: | ||
pattern: ^/(_(profiler|wdt)|css|images|js)/ | ||
security: false | ||
main: | ||
anonymous: true |
10 changes: 10 additions & 0 deletions
10
features/Fixtures/Project/config/packages/sonata_admin.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
sonata_admin: | ||
title: 'Sonata Admin' | ||
dashboard: | ||
blocks: | ||
- {type: sonata.admin.block.admin_list, position: left} | ||
|
||
sonata_block: | ||
blocks: | ||
sonata.admin.block.admin_list: | ||
contexts: [admin] |
4 changes: 4 additions & 0 deletions
4
features/Fixtures/Project/config/packages/sonata_auto_configure.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
sonata_auto_configure: | ||
entity: | ||
namespaces: | ||
- {namespace: KunicMarko\SonataAutoConfigureBundle\Features\Fixtures\Project\Entity, manager_type: orm} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
sonata_core: | ||
form: | ||
mapping: | ||
enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
twig: | ||
debug: '%kernel.debug%' | ||
strict_variables: '%kernel.debug%' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
admin_area: | ||
resource: "@SonataAdminBundle/Resources/config/routing/sonata_admin.xml" | ||
prefix: /admin | ||
|
||
_sonata_admin: | ||
resource: . | ||
type: sonata_admin | ||
prefix: /admin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
parameters: | ||
locale: 'en' | ||
|
||
services: | ||
_defaults: | ||
autowire: true | ||
autoconfigure: true | ||
public: false | ||
|
||
KunicMarko\SonataAutoConfigureBundle\Features\Fixtures\Project\: | ||
resource: '../src/*' | ||
exclude: '../src/{Entity,Kernel.php}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
use KunicMarko\SonataAutoConfigureBundle\Features\Fixtures\Project\Kernel; | ||
use Symfony\Component\HttpFoundation\Request; | ||
|
||
require __DIR__.'/../../../../vendor/autoload.php'; | ||
|
||
umask(0000); | ||
|
||
$kernel = new Kernel('test', true); | ||
$request = Request::createFromGlobals(); | ||
$response = $kernel->handle($request); | ||
$response->send(); | ||
$kernel->terminate($request, $response); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace KunicMarko\SonataAutoConfigureBundle\Features\Fixtures\Project\Admin; | ||
|
||
use Sonata\AdminBundle\Admin\AbstractAdmin; | ||
use Sonata\AdminBundle\Datagrid\DatagridMapper; | ||
use Sonata\AdminBundle\Datagrid\ListMapper; | ||
use Sonata\AdminBundle\Form\FormMapper; | ||
|
||
final class CategoryAdmin extends AbstractAdmin | ||
{ | ||
protected function configureDatagridFilters(DatagridMapper $datagridMapper) | ||
{ | ||
$datagridMapper->add('name'); | ||
} | ||
|
||
protected function configureListFields(ListMapper $listMapper) | ||
{ | ||
$listMapper | ||
->addIdentifier('name') | ||
->add('_action', 'actions', [ | ||
'actions' => [ | ||
'edit' => [], | ||
'delete' => [], | ||
] | ||
]); | ||
} | ||
|
||
protected function configureFormFields(FormMapper $formMapper) | ||
{ | ||
$formMapper->add('name'); | ||
} | ||
} |
Oops, something went wrong.