Victoire and its Widgets must implement Continous Integration with CircleCI and Behat tests. This test suite must be used as a git submodule in your repository.
git submodule add [email protected]:Victoire/test-suite.git victoire-test-suite
If you need to update the test suite, run git submodule update --init
command.
Add the following circle.yml
config at your repository root.
machine:
timezone:
Europe/Paris
hosts:
fr.victoire.io: 127.0.0.1
en.victoire.io: 127.0.0.1
services:
- redis
php:
version: 7.1.0
checkout:
post:
- git submodule sync
- git submodule update --init
dependencies:
override:
- bash victoire-test-suite/dependencies.sh user/repo
cache_directories:
- ~/.composer/cache
test:
override:
- bash victoire-test-suite/circle.sh user/repo:
parallel: true
- bash victoire-test-suite/test.sh user/repo
general:
artifacts:
- "fails"
Replace user/repo
with your own repository name.
This name must contain the string "widget" if you want to test a Widget.
If it doesn't, only Victoire core tests will be launched.
On your repository go to Settings
/Integrations & services
/Services
and add CircleCI service.
.feature
files must be stored in Tests/Features
folder.
Take a look at Victoire Tests/Features/Context
folder to use contexts based on Victoire UI.
You may need to register your Bundle and other Bundles your required in Victoire Test Appkernel. You can do so by adding a Tests/Bundles.php
file:
<?php
$victoireTestBundles = [
new Victoire\Widget\SearchBundle\VictoireWidgetSearchBundle(),
new FOS\ElasticaBundle\FOSElasticaBundle(),
];
You may also need to add config. You can do so by adding a Tests/config.yml
file:
fos_elastica:
clients:
default: { host: localhost, port: 9200 }
indexes:
...
You can also add specific Contexts for your Behat tests. Simply add as many Contexts as you need in a Tests/Context
folder. These php files must match the pattern name *Context.php
:
<?php
namespace Victoire\Widget\SearchBundle\Tests\Context;
use Knp\FriendlyContexts\Context\RawMinkContext;
class WidgetContext extends RawMinkContext
{
/**
* @When /^I test a specific step from my Bundle/
*/
public function iTestA specificStepFromMyBundle()
{
...
}
}
You can run external dependencies by adding a Tests/dependencies.sh
file.
License can be found here.