Skip to content
This repository was archived by the owner on Jul 9, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 24 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
BehatSandbox
========================
# Behat Skeleton

Basic implementations with Majora Skeleton
Ceci est un example pour l'implémentation d'un skeleton Majora avec un bootstrap pour les tests Behat.

3 suites for the post entity:
- post_dal_domain (to test internal domain)
- post_api_controller (to test api)
- post_api_domain (to test sdk)
Pour faire fonctionner les tests behat, il vous faudra configurer le fichier behat.yml à la racine de votre projet de la manière suivante :

1 feature in Lv\Acme\Bundle\ApiBundle\Features
```yml
imports:
- app/config/parameters.yml

4 contexts:
- PostContext : basic actions for every suite
- PostApiContext : context to test the api
- PostDomainContext : context to test the dal and api domains
- PostRouterContext : just to configure majora router, perhaps not needed, obviously must be refacto as an extension if needed.
default:
autoload:
'': %paths.base%/src
extensions:
Behat\Symfony2Extension: ~ # Using the Symfony Extension
suites:
dal_domain: # Name your suite as you wish.
type: symfony_bundle
bundle: LvExampleDalBundle # Your generated bundle
paths:
- %paths.base%/src/Lv/Example/Bundle/ApiBundle/Features # Path to your generated features
contexts:
- Lv\Example\Bundle\ApiBundle\Features\Context\EntityContext: # Class of your generated entity context
domain: '@lv.entity.domain' # Domain service of your generated entity (majora_vendor.majora_entity.domain)
loader: '@Lv.entity.loader' # Loader service of your generated entity (majora_vendor.majora_entity.domain)
em: '@doctrine.orm.entity_manager' # Doctrine entity manager
```

Libre à vous ensuite de compléter ces tests avec vos règles métiers.
6 changes: 3 additions & 3 deletions app/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ public function registerBundles()
new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new Majora\Bundle\FrameworkExtraBundle\MajoraFrameworkExtraBundle($this),
new Acme\Lv\Bundle\ApiBundle\AcmeLvApiBundle(),
new Acme\Lv\Bundle\DalBundle\AcmeLvDalBundle(),
new Acme\Lv\Bundle\SdkBundle\AcmeLvSdkBundle(),
new Lv\Example\Bundle\ApiBundle\LvExampleApiBundle(),
new Lv\Example\Bundle\SdkBundle\LvExampleSdkBundle(),
new Lv\Example\Bundle\DalBundle\LvExampleDalBundle(),
];

if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
Expand Down
19 changes: 19 additions & 0 deletions app/config/behat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
imports:
- app/config/parameters.yml

default:
autoload:
'': %paths.base%/src
extensions:
Behat\Symfony2Extension: ~
suites:
dal_domain:
type: symfony_bundle
bundle: Sir1Partner3DalBundle
paths:
- %paths.base%/src/Sir1/Partner3/Bundle/ApiBundle/Features
contexts:
- Sir1\Partner3\Bundle\ApiBundle\Features\Context\Person2Context:
domain: '@sir1.person2.domain'
loader: '@sir1.person2.loader'
em: '@doctrine.orm.entity_manager'
6 changes: 3 additions & 3 deletions app/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ doctrine:
entity_managers:
default:
mappings:
AcmeLvDalBundle:
LvExampleDalBundle:
type: yml
dir: Resources/config/doctrine
prefix: Acme\Lv\Component\Entity
alias: AcmeLv
prefix: Lv\Example\Component\Entity
alias: LvExample

# Swiftmailer Configuration
swiftmailer:
Expand Down
2 changes: 0 additions & 2 deletions app/config/routing.yml
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
app:
resource: "@AcmeLvSdkBundle/Resources/config/routing/auto/auto_post.yml"
46 changes: 2 additions & 44 deletions behat.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,2 @@
default:
autoload:
'': %paths.base%/src
extensions:
Behat\Symfony2Extension: ~
suites:
api_controller:
type: symfony_bundle
bundle: AcmeLvApiBundle
paths: [ %paths.base%/src/Acme/Lv/Bundle/ApiBundle/Features ]
contexts:
- Acme\Lv\Bundle\ApiBundle\Features\Context\PostApiControllerContext:
em: '@doctrine.orm.entity_manager'
router: '@router'
- Acme\Lv\Bundle\ApiBundle\Features\Context\PostRouterContext:
router: '@router'
host: 'localhost'
scheme: 'http'
baseUrl: '/web/app.php'
port: '9001'
dal_domain:
type: symfony_bundle
bundle: AcmeLvDalBundle
paths: [ %paths.base%/src/Acme/Lv/Bundle/ApiBundle/Features ]
contexts:
- Acme\Lv\Bundle\ApiBundle\Features\Context\PostDalDomainContext:
domain: '@acme.post.domain'
loader: '@acme.post.loader'
em: '@doctrine.orm.entity_manager'
api_domain:
type: symfony_bundle
bundle: AcmeLvDalBundle
paths: [ %paths.base%/src/Acme/Lv/Bundle/ApiBundle/Features ]
contexts:
- Acme\Lv\Bundle\ApiBundle\Features\Context\PostApiDomainContext:
em: '@doctrine.orm.entity_manager'
domain: '@acme.post.api_domain'
loader: '@acme.post.api_loader'
- Acme\Lv\Bundle\ApiBundle\Features\Context\PostRouterContext:
router: '@router'
host: 'localhost'
scheme: 'http'
baseUrl: '/web/app.php'
port: '9001'
imports:
- app/config/behat.yml
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"require-dev": {
"sensio/generator-bundle": "^3.0",
"symfony/phpunit-bridge": "^3.0",
"majora/generator-bundle": "dev-master",
"majora/generator-bundle": "dev-feature/add-behat-generator",
"behat/behat": "dev-master",
"behat/symfony2-extension": "dev-master",
"behat/mink-extension": "^2.1",
Expand Down
16 changes: 8 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading