Skip to content

Commit cb59b82

Browse files
authored
Private service (#7)
v5.0 beta
1 parent bd8de54 commit cb59b82

37 files changed

+1303
-437
lines changed

.github/CONTRIBUTING.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Contributing
2+
3+
First of all, **thank you** for contributing.
4+
5+
Bugs or feature requests can be posted online on the GitHub issues section of the project.
6+
7+
Few rules to ease code reviews and merges:
8+
9+
- You MUST follow the [PSR-1](http://www.php-fig.org/psr/psr-1/), [PSR-2](http://www.php-fig.org/psr/psr-2/) and [PSR-4](http://www.php-fig.org/psr/psr-4/) coding standards.
10+
- You MUST run the test suite.
11+
- You MUST write (or update) unit tests when bugs are fixed or features are added.
12+
- You SHOULD write documentation.
13+
14+
We use [Git-Flow](http://jeffkreeftmeijer.com/2010/why-arent-you-using-git-flow/) to automate our git branching workflow.
15+
16+
To contribute use [Pull Requests](https://help.github.com/articles/using-pull-requests), please, write commit messages that make sense, and rebase your branch before submitting your PR.
17+
18+
May be asked to squash your commits too. This is used to "clean" your Pull Request before merging it, avoiding commits such as fix tests, fix 2, fix 3, etc.
19+
20+
Run test suite
21+
------------
22+
23+
* install composer: `curl -s http://getcomposer.org/installer | php`
24+
* install dependencies: `php composer.phar install`
25+
* run tests: `vendor/bin/behat`

.github/ISSUE_TEMPLATE.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
| Q | A
2+
| -------------------- | -----
3+
| Bug report? | yes/no
4+
| Feature request? | yes/no
5+
| BC Break report? | yes/no
6+
| RFC? / Specification | yes/no
7+
| Project version | x.y(.z)
8+
9+
<!--
10+
Fill in this template according to your issue.
11+
Otherwise, replace this comment by the description of your issue.
12+
13+
Please consider the following requirements
14+
* You MUST never send security issues here. If you think that your issue is a security one then contact Spomky in private at https://gitter.im/Spomky/
15+
* You should not post many lines of source code or console logs. Small inputs (approx 5 lines) are acceptable otherwize you should use a third party service (e.g. Pastebin, Chop...).
16+
-->

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
| Q | A
2+
| ------------- | ---
3+
| Branch? | master
4+
| Bug fix? | yes/no #... <!-- #-prefixed issue number(s), if any -->
5+
| New feature? | yes/no
6+
| BC breaks? | yes/no
7+
| Deprecations? | yes/no
8+
| Tests added | <!-- highly recommended for new feature or bug fix -->
9+
| Doc added | <!-- highly recommended for new feature or bug fix -->
10+
11+
<!--
12+
Fill in this template according to the PR you're about to submit.
13+
Replace this comment by a description of what your PR is solving.
14+
15+
Please consider the following requirement:
16+
* Modification of existing tests should be avoided unless deemed necessary.
17+
* You MUST never open a PR related to a security issue. Contact Spomky in private at https://gitter.im/Spomky/
18+
-->

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/tests/app/cache
2+
/tests/app/sqlite.db.cache
3+
/composer.lock

.scrutinizer.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
filter:
2+
excluded_paths: ["vendor/*", "tests/*"]
3+
4+
build_failure_conditions:
5+
- 'elements.rating(<= C).exists' # No classes/methods with a rating of C or worse
6+
- 'project.metric("scrutinizer.quality", < 9)' # Code Quality Rating drops below 9

.travis.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
language: php
2+
3+
branches:
4+
except:
5+
- /^bugfix\/.*$/
6+
- /^feature\/.*$/
7+
- /^optimization\/.*$/
8+
9+
sudo: false
10+
11+
cache:
12+
directories:
13+
- $HOME/.composer/cache/files
14+
15+
matrix:
16+
include:
17+
- php: 7.1
18+
env: SYMFONY_VERSION='3.4.*'
19+
- php: 7.1
20+
env: SYMFONY_VERSION='4.0.*'
21+
- php: 7.1
22+
env: DEPS=dev SYMFONY_VERSION='4.1.*'
23+
- php: 7.2
24+
env: SYMFONY_VERSION='4.0.*'
25+
- php: nightly
26+
env: DEPS=dev SYMFONY_VERSION='4.1.*'
27+
allow_failures:
28+
- php: 7.1
29+
env: SYMFONY_VERSION='4.1.*'
30+
- php: nightly
31+
env: SYMFONY_VERSION='4.1.*'
32+
33+
before_install:
34+
- composer self-update
35+
- mkdir -p ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d && echo "memory_limit=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
36+
- if [ "$DEPS" = 'dev' ]; then perl -pi -e 's/^}$/,"minimum-stability":"dev"}/' composer.json; fi;
37+
- if [ "$SYMFONY_VERSION" != "" ]; then composer require --no-update "symfony/symfony:${SYMFONY_VERSION}"; fi;
38+
39+
install:
40+
- composer install --no-progress
41+
42+
before_script:
43+
- cd tests/
44+
45+
script:
46+
- ../vendor/bin/behat --strict
47+
48+
after_script:
49+
- cd ../

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Copyright (c) 2012 Anthon Pang
2-
Copyright (c) 2016 Florent Morselli
2+
Copyright (c) 2016-2018 Florent Morselli
33

44
Permission is hereby granted, free of charge, to any person obtaining
55
a copy of this software and associated documentation files (the

README.md

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ default:
2828
# ...
2929
extensions:
3030
BehatExtension\DoctrineDataFixturesExtension\Extension:
31-
lifetime: feature
31+
lifetime: 'feature'
3232
autoload: true
3333
directories: ~
3434
fixtures: ~
@@ -38,49 +38,66 @@ When **lifetime** is set to "feature" (or unspecified), data fixtures are reload
3838
when **lifetime** is set to "scenario", data fixtures are reloaded between scenarios (i.e., increased
3939
test isolation at the expense of increased run time).
4040
41-
When **autoload** is true, the DoctrineDataFixtures extension will load the data fixtures for all
42-
registered bundles (similar to `app/console doctrine:fixtures:load`).
41+
When **autoload** is true, the extension will load the data fixtures for registered bundles.
42+
Please note that only fixtures stored in the folder `/DataFixtures/ORM` of the bundles are loaded.
43+
If you want to load fixtures tagged with `doctrine.fixture.orm`, you must enable the bundle `BehatExtension\DoctrineDataFixturesExtension\Bundle\BehatDoctrineDataFixturesExtensionBundle`
44+
in your test `AppKernel` class.
4345

44-
When **fixtures** is set and **autoload** is false, the DoctrineDataFixtures
45-
extension will load the specified fixture classes.
46+
When **fixtures** is set, the DoctrineDataFixtures extension will load the specified fixture classes.
4647

47-
When **directories** is set and **autoload** is false, the DoctrineDataFixtures
48-
extension will load the data fixtures globed from the respective directories.
48+
When **directories** is set, the DoctrineDataFixtures extension will load the data fixtures globed from the respective directories.
4949

5050
```yaml
5151
# behat.yml
5252
default:
5353
# ...
5454
extensions:
5555
BehatExtension\DoctrineDataFixturesExtension\Extension:
56-
lifetime: feature
56+
lifetime: 'feature'
5757
autoload: true
5858
directories:
59-
- /project/src/AcmeAnalytics/Tests/DataFixtures/ORM
59+
- '/project/src/AcmeAnalytics/Tests/DataFixtures/ORM'
6060
fixtures:
61-
- Acme\StoreBundle\DataFixture\ORM\Categories
62-
- Acme\StoreBundle\DataFixture\ORM\Apps
63-
- Acme\VendorBundle\DataFixture\ORM\Vendors
61+
- 'Acme\StoreBundle\DataFixture\ORM\Categories'
62+
- 'Acme\StoreBundle\DataFixture\ORM\Apps'
63+
- 'Acme\VendorBundle\DataFixture\ORM\Vendors'
6464
```
6565

66-
# Limitations
66+
# Backup System
6767

68-
When using the SqlLiteDriver, the .db file is cached to speed up reloading. You should periodically clear the cache as it does not detect changes to the data fixture contents because the hash is based on the collection of data fixture class names.
68+
To speed up the tests, a backup system is available. The whole database will be set in cache and reloaded when needed.
69+
You should periodically clear the cache as it does not detect changes to the data fixture contents because the hash is based on the collection of data fixture class names.
70+
71+
This feature is only available for the following SGDB: SQLite, MySQL, PostgreSQL.
72+
73+
It is enabled by default. To disable it, you just have to set `use_backup: false` in the extension configuration:
74+
75+
```yaml
76+
# behat.yml
77+
default:
78+
# ...
79+
extensions:
80+
BehatExtension\DoctrineDataFixturesExtension\Extension:
81+
lifetime: 'feature'
82+
autoload: true
83+
use_backup: false
84+
```
6985

7086
# Source
7187

72-
`Github <https://github.com/vipsoft/DoctrineDataFixturesExtension>`_
88+
Github: [https://github.com/BehatExtension/DoctrineDataFixturesExtension](https://github.com/BehatExtension/DoctrineDataFixturesExtension)
7389

74-
Forked from `Github <https://github.com/BehatExtension/DoctrineDataFixturesExtension>`_
90+
Forked from [https://github.com/vipsoft/DoctrineDataFixturesExtension](https://github.com/vipsoft/DoctrineDataFixturesExtension)
7591

7692
# Copyright
7793

7894
* Copyright (c) 2012 Anthon Pang.
79-
* Copyright (c) 2016 Florent Morselli.
95+
* Copyright (c) 2016-2018 Florent Morselli.
8096

8197
See [LICENSE](LICENSE) for details.
8298

8399
# Contributors
84100

85-
* Anthon Pang `(robocoder) <http://github.com/robocoder>`_
86-
* `Others <https://github.com/BehatExtension/DoctrineDataFixturesExtension/graphs/contributors>`_
101+
* Anthon Pang ([robocoder](http://github.com/robocoder))
102+
* Florent Morselli ([Spomky](http://github.com/Spomky))
103+
* [Others contributors](https://github.com/BehatExtension/DoctrineDataFixturesExtension/graphs/contributors)

composer.json

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,32 @@
1717
}
1818
],
1919
"require": {
20-
"php": ">=5.3.6",
20+
"php": "^7.1",
2121
"behat/behat": "^3.0",
2222
"behat/symfony2-extension": "^2.0",
23-
"doctrine/data-fixtures": "^1.0"
23+
"doctrine/data-fixtures": "^1.0",
24+
"doctrine/orm": "^2.6",
25+
"symfony/dependency-injection": "^3.4|^4.0"
26+
},
27+
"require-dev": {
28+
"doctrine/doctrine-bundle": "^1.8",
29+
"doctrine/doctrine-fixtures-bundle": "^3.0",
30+
"phpstan/phpstan": "^0.9.2",
31+
"symfony/process": "^3.4|^4.0"
2432
},
2533
"suggest": {
26-
"doctrine/migrations": "Uses DBAL to load versioned database schema and migration classes"
34+
"doctrine/migrations": "Uses DBAL to load versioned database schema and migration classes",
35+
"symfony/process": "For backup support on pgsql or mysql platforms"
2736
},
2837
"autoload": {
2938
"psr-4": { "BehatExtension\\DoctrineDataFixturesExtension\\": "src/" }
3039
},
40+
"autoload-dev": {
41+
"psr-4": { "BehatExtension\\DoctrineDataFixturesExtension\\Tests\\": "tests/" }
42+
},
3143
"extra": {
3244
"branch-alias": {
33-
"dev-master": "1.0.x-dev"
45+
"dev-master": "5.0.x-dev"
3446
}
3547
}
3648
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/*
6+
* The MIT License (MIT)
7+
*
8+
* Copyright (c) 2016-2018 Spomky-Labs
9+
*
10+
* This software may be modified and distributed under the terms
11+
* of the MIT license. See the LICENSE file for details.
12+
*/
13+
14+
namespace BehatExtension\DoctrineDataFixturesExtension\Bundle;
15+
16+
use Symfony\Component\DependencyInjection\Alias;
17+
use Symfony\Component\DependencyInjection\ContainerBuilder;
18+
use Symfony\Component\DependencyInjection\Extension\Extension;
19+
use Symfony\Component\HttpKernel\Bundle\Bundle;
20+
21+
final class BehatDoctrineDataFixturesExtensionBundle extends Bundle
22+
{
23+
/**
24+
* {@inheritdoc}
25+
*/
26+
public function getContainerExtension()
27+
{
28+
return new class() extends Extension {
29+
public function load(array $configs, ContainerBuilder $container)
30+
{
31+
$container->setAlias('doctrine.fixtures.loader.alias', new Alias('doctrine.fixtures.loader', true));
32+
}
33+
34+
public function getAlias()
35+
{
36+
return 'behat_doctrine_data_fixtures_extension';
37+
}
38+
};
39+
}
40+
}

0 commit comments

Comments
 (0)