Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Commit 95de338

Browse files
support for symfony 3.4, rework test app structure
* # This is a combination of 29 commits. # This is the 1st commit message: DevKit updates # This is the commit message #2: improvements to get the tests running # This is the commit message #3: try to call unit tests only # This is the commit message #4: DevKit updates # This is the commit message #5: add correct cache/log path to gitignor # This is the commit message #6: DevKit updates # This is the commit message #7: DevKit updates # This is the commit message #8: DevKit updates # This is the commit message #9: DevKit updates # This is the commit message #10: DevKit updates # This is the commit message #11: DevKit updates # This is the commit message #12: restriction on sebastion/exporter # This is the commit message #13: fix composer.json # This is the commit message #14: use higher versions # This is the commit message #15: use higher version # This is the commit message #16: DevKit updates # This is the commit message #17: DevKit updates # This is the commit message #18: DevKit updates # This is the commit message #19: try verbose # This is the commit message #20: try testdox # This is the commit message #21: try makefile change # This is the commit message #22: try travis # This is the commit message #23: back # This is the commit message #24: restrict sebastianbergmann/environment # This is the commit message #25: restrict sebastianbergmann/environment # This is the commit message #26: try to turn around # This is the commit message #27: support symfony 3.4, new testing app folder structure # This is the commit message #28: support symfony 3.4, new testing app folder structure # This is the commit message #29: use caret operator for symfony-cmf/resource-bundle * merge conflicts DevKit updates for master branch (#59) * DevKit updates * DevKit updates * merge conflicts fixes due to StyleCI fix symfony component version * re add packages after merging
1 parent bed0062 commit 95de338

File tree

19 files changed

+89
-78
lines changed

19 files changed

+89
-78
lines changed

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
tests/Resources/app/cache
2-
tests/Resources/app/logs
1+
2+
tests/Fixtures/App/var
3+
!tests/Fixtures/App/var/.gitempty
34
composer.lock
45
vendor

.travis.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,33 +26,30 @@ cache:
2626
- $HOME/.composer/cache/files
2727

2828
env:
29-
matrix: SYMFONY_VERSION=^4@dev
29+
matrix: SYMFONY_VERSION=^3.4@dev
3030
global:
3131
- SYMFONY_DEPRECATIONS_HELPER=0
3232
- SYMFONY_PHPUNIT_DIR=.phpunit SYMFONY_PHPUNIT_REMOVE="symfony/yaml"
33+
- KERNEL_CLASS=Symfony\Cmf\Bundle\ResourceRestBundle\Tests\Fixtures\App\Kernel
3334
- SYMFONY_PHPUNIT_VERSION=5.7
3435
- TEST_INSTALLATION=false
3536

3637
matrix:
3738
include:
3839
- php: 7.1
39-
env: DEPS=dev SYMFONY_VERSION=^4@dev
40+
env: DEPS=dev SYMFONY_VERSION=^4.0@dev
4041
- php: 7.1
4142
env: DEPS=dev SYMFONY_VERSION=^3.4@dev
42-
- php: 7.0
43-
env: COMPOSER_FLAGS="--prefer-lowest" SYMFONY_VERSION=2.8.* SYMFONY_DEPRECATIONS_HELPER=weak
44-
- php: 7.1
45-
env: SYMFONY_VERSION=3.1.*
4643
- php: 7.1
47-
env: SYMFONY_VERSION=3.2.*
44+
env: COMPOSER_FLAGS="--prefer-lowest" SYMFONY_VERSION=2.8.* SYMFONY_DEPRECATIONS_HELPER=weak
4845
- php: 7.1
4946
env: SYMFONY_VERSION=3.3.*
5047
- env: TEST_INSTALLATION=true
5148

5249
fast_finish: true
5350
allow_failures:
5451
- php: 7.1
55-
env: DEPS=dev SYMFONY_VERSION=^4@dev
52+
env: DEPS=dev SYMFONY_VERSION=^4.0@dev
5653
- env: TEST_INSTALLATION=true
5754

5855

Makefile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,14 @@
1313
# file that was distributed with this source code. #
1414
############################################################################
1515

16-
ifeq ("symfony-cmf/resource-rest-bundle", "symfony-cmf/testing")
17-
TESTING_SCRIPTS_DIR=bin
18-
else
1916
TESTING_SCRIPTS_DIR=vendor/symfony-cmf/testing/bin
20-
endif
2117
CONSOLE=${TESTING_SCRIPTS_DIR}/console
2218
VERSION=dev-master
2319
ifdef BRANCH
2420
VERSION=dev-${BRANCH}
2521
endif
2622
PACKAGE=symfony-cmf/resource-rest-bundle
23+
export KERNEL_CLASS=Symfony\Cmf\Bundle\ResourceRestBundle\Tests\Fixtures\App\Kernel
2724
list:
2825
@echo 'test: will run all tests'
2926
@echo 'unit_tests: will run unit tests only'

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,22 @@ under the [MIT License](LICENSE).
1717

1818
This Bundle provides a REST API to Puli resources as provided by the CmfResource component.
1919

20+
#### Running Behat
21+
22+
1. Run web server:
23+
```
24+
KERNEL_CLASS="Symfony\Cmf\Bundle\ResourceRestBundle\Tests\Fixtures\App\Kernel" ./vendor/symfony-cmf/testing/bin/console server:run -d vendor/symfony-cmf/testing/resources/web/ 8000
25+
```
26+
2. Run the behat tests:
27+
```
28+
KERNEL_CLASS="Symfony\Cmf\Bundle\ResourceRestBundle\Tests\Fixtures\App\Kernel" ./vendor/bin/behat
29+
```
30+
2031

2132
## Requirements
2233

23-
* PHP 7.0 / 7.1
24-
* Symfony 2.8 / 3.1 / 3.2 / 3.3 / ^3.4@dev
34+
* PHP 7.1
35+
* Symfony 2.8 / 3.3 / ^3.4@dev
2536
* See also the `require` section of [composer.json](composer.json)
2637

2738
## Documentation

composer.json

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,28 @@
1313
"php": "^5.6|^7.0",
1414
"symfony-cmf/resource-bundle": "^1.0",
1515
"jms/serializer-bundle": "^1.0 | ^2.0",
16-
"symfony/translation": "^2.8|^3.0",
17-
"symfony/symfony": "2.8.*"
16+
"symfony/translation": "^2.8|^3.0"
1817
},
1918
"require-dev": {
2019
"symfony-cmf/testing": "^2.1@dev",
2120
"symfony/phpunit-bridge": "^3.3.10",
22-
"doctrine/phpcr-odm": "^1.3",
21+
"doctrine/phpcr-odm": "^1.4|^2.0",
2322
"jms/serializer": "^1.2",
2423
"behat/behat": "^3.0.6",
2524
"behat/web-api-extension" : "^1.0@dev",
2625
"matthiasnoback/symfony-dependency-injection-test": "^1.1",
27-
"matthiasnoback/symfony-config-test": "^2.1"
26+
"matthiasnoback/symfony-config-test": "^2.1",
27+
"symfony/twig-bundle": "^2.8|^3.3",
28+
"symfony/validator": "^2.8|^3.3",
29+
"symfony/security-bundle": "^2.8|^3.3",
30+
"symfony/asset": "^2.8|^3.3",
31+
"symfony/templating": "^2.8|^3.3",
32+
"symfony/form": "^2.8|^3.3",
33+
"symfony/web-server-bundle": "^2.8|^3.3",
34+
"symfony/translation": "^2.8|^3.3"
2835
},
36+
"minimum-stability":"dev",
37+
2938
"prefer-stable": true,
3039
"suggest": {
3140
"doctrine/phpcr-odm": "To enable support for the PHPCR ODM documents (^1.2)",

phpunit.xml.dist

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,4 @@
2020
</exclude>
2121
</whitelist>
2222
</filter>
23-
24-
<php>
25-
<server name="KERNEL_DIR" value="tests/Resources/app" />
26-
</php>
27-
2823
</phpunit>

tests/Features/Context/ResourceContext.php

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Behat\Gherkin\Node\TableNode;
1818
use PHPCR\Util\NodeHelper;
1919
use PHPCR\Util\PathHelper;
20+
use Symfony\Cmf\Bundle\ResourceRestBundle\Tests\Fixtures\App\Kernel;
2021
use Symfony\Component\Filesystem\Filesystem;
2122
use Symfony\Component\Finder\Finder;
2223
use Symfony\Component\HttpKernel\KernelInterface;
@@ -35,9 +36,9 @@ class ResourceContext implements Context
3536
public function __construct()
3637
{
3738
require_once __DIR__.'/../../../vendor/symfony-cmf/testing/bootstrap/bootstrap.php';
38-
require_once __DIR__.'/../../Resources/app/AppKernel.php';
39+
require_once __DIR__.'/../../Fixtures/App/Kernel.php';
3940

40-
$this->kernel = new \AppKernel('test', true);
41+
$this->kernel = new Kernel('test', true);
4142
}
4243

4344
/**
@@ -49,7 +50,7 @@ public function __construct()
4950
*/
5051
public static function getConfigurationFile()
5152
{
52-
return __DIR__.'/../../Resources/app/cache/resource.yml';
53+
return __DIR__.'/../../Fixtures/App/var/cache/resource.yml';
5354
}
5455

5556
/**
@@ -108,7 +109,7 @@ public function createFile($filename, PyStringNode $content)
108109
*/
109110
public function createDocument($class, $path, TableNode $fields)
110111
{
111-
$class = 'Symfony\\Cmf\\Bundle\\ResourceRestBundle\\Tests\\Resources\\TestBundle\\Document\\'.$class;
112+
$class = 'Symfony\\Cmf\\Bundle\\ResourceRestBundle\\Tests\\Fixtures\\App\\Document\\'.$class;
112113
$path = '/tests'.$path;
113114

114115
$parentPath = PathHelper::getParentPath($path);
@@ -142,7 +143,7 @@ public function createDocument($class, $path, TableNode $fields)
142143
*/
143144
public function thereIsADocumentAt($class, $path, TableNode $fields = null)
144145
{
145-
$class = 'Symfony\\Cmf\\Bundle\\ResourceRestBundle\\Tests\\Resources\\TestBundle\\Document\\'.$class;
146+
$class = 'Symfony\\Cmf\\Bundle\\ResourceRestBundle\\Tests\\Fixtures\\App\\Document\\'.$class;
146147
$path = '/tests'.$path;
147148

148149
if (!class_exists($class)) {
@@ -170,7 +171,7 @@ public function thereIsADocumentAt($class, $path, TableNode $fields = null)
170171
*/
171172
public function thereIsNoDocumentAt($class, $path)
172173
{
173-
$class = 'Symfony\\Cmf\\Bundle\\ResourceRestBundle\\Tests\\Resources\\TestBundle\\Document\\'.$class;
174+
$class = 'Symfony\\Cmf\\Bundle\\ResourceRestBundle\\Tests\\Fixtures\\App\\Document\\'.$class;
174175
$path = '/tests'.$path;
175176

176177
if (!class_exists($class)) {
@@ -191,7 +192,11 @@ public function thereIsNoDocumentAt($class, $path)
191192
private function clearDiCache()
192193
{
193194
$finder = new Finder();
194-
$finder->in($this->kernel->getCacheDir());
195+
$dirs = $this->kernel->getCacheDir();
196+
if (!is_dir($dirs)) {
197+
return;
198+
}
199+
$finder->in($dirs);
195200
$finder->name('*.php');
196201
$finder->name('*.php.meta');
197202
$filesystem = new Filesystem();

tests/Features/nesting.feature

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Feature: Nesting resources
3232
"repository_alias": "default",
3333
"repository_type": "doctrine/phpcr-odm",
3434
"payload_alias": null,
35-
"payload_type": "Symfony\\Cmf\\Bundle\\ResourceRestBundle\\Tests\\Resources\\TestBundle\\Document\\Article",
35+
"payload_type": "Symfony\\Cmf\\Bundle\\ResourceRestBundle\\Tests\\Fixtures\\App\\Document\\Article",
3636
"path": "\/foo",
3737
"node_name": "foo",
3838
"label": "foo",
@@ -42,7 +42,7 @@ Feature: Nesting resources
4242
"repository_alias": "default",
4343
"repository_type": "doctrine/phpcr-odm",
4444
"payload_alias": null,
45-
"payload_type": "Symfony\\Cmf\\Bundle\\ResourceRestBundle\\Tests\\Resources\\TestBundle\\Document\\Article",
45+
"payload_type": "Symfony\\Cmf\\Bundle\\ResourceRestBundle\\Tests\\Fixtures\\App\\Document\\Article",
4646
"path": "\/foo\/sub",
4747
"node_name": "sub",
4848
"label": "sub",
@@ -63,7 +63,7 @@ Feature: Nesting resources
6363
"repository_alias": "default",
6464
"repository_type": "doctrine/phpcr-odm",
6565
"payload_alias": null,
66-
"payload_type": "Symfony\\Cmf\\Bundle\\ResourceRestBundle\\Tests\\Resources\\TestBundle\\Document\\Article",
66+
"payload_type": "Symfony\\Cmf\\Bundle\\ResourceRestBundle\\Tests\\Fixtures\\App\\Document\\Article",
6767
"path": "\/foo",
6868
"node_name": "foo",
6969
"label": "foo",

tests/Features/resource_api_phpcr_odm.feature

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Feature: PHPCR-ODM resource repository
1717
payload_alias_map:
1818
article:
1919
repository: doctrine/phpcr-odm
20-
type: "Symfony\\Cmf\\Bundle\\ResourceRestBundle\\Tests\\Resources\\TestBundle\\Document\\Article"
20+
type: "Symfony\\Cmf\\Bundle\\ResourceRestBundle\\Tests\\Fixtures\\App\\Document\\Article"
2121
security:
2222
access_control:
2323
- { pattern: '^/', require: IS_AUTHENTICATED_ANONYMOUSLY }
@@ -36,7 +36,7 @@ Feature: PHPCR-ODM resource repository
3636
"repository_alias": "phpcrodm_repo",
3737
"repository_type": "doctrine/phpcr-odm",
3838
"payload_alias": "article",
39-
"payload_type": "Symfony\\Cmf\\Bundle\\ResourceRestBundle\\Tests\\Resources\\TestBundle\\Document\\Article",
39+
"payload_type": "Symfony\\Cmf\\Bundle\\ResourceRestBundle\\Tests\\Fixtures\\App\\Document\\Article",
4040
"path": "\/foo",
4141
"node_name": "foo",
4242
"label": "foo",
@@ -66,7 +66,7 @@ Feature: PHPCR-ODM resource repository
6666
"repository_alias": "phpcrodm_repo",
6767
"repository_type": "doctrine/phpcr-odm",
6868
"payload_alias": "article",
69-
"payload_type": "Symfony\\Cmf\\Bundle\\ResourceRestBundle\\Tests\\Resources\\TestBundle\\Document\\Article",
69+
"payload_type": "Symfony\\Cmf\\Bundle\\ResourceRestBundle\\Tests\\Fixtures\\App\\Document\\Article",
7070
"path": "\/foo",
7171
"node_name": "foo",
7272
"label": "foo",
@@ -76,7 +76,7 @@ Feature: PHPCR-ODM resource repository
7676
"repository_alias": "phpcrodm_repo",
7777
"repository_type": "doctrine/phpcr-odm",
7878
"payload_alias": "article",
79-
"payload_type": "Symfony\\Cmf\\Bundle\\ResourceRestBundle\\Tests\\Resources\\TestBundle\\Document\\Article",
79+
"payload_type": "Symfony\\Cmf\\Bundle\\ResourceRestBundle\\Tests\\Fixtures\\App\\Document\\Article",
8080
"path": "/foo/bar",
8181
"node_name": "bar",
8282
"label": "bar",
@@ -88,7 +88,7 @@ Feature: PHPCR-ODM resource repository
8888
"repository_alias": "phpcrodm_repo",
8989
"repository_type": "doctrine/phpcr-odm",
9090
"payload_alias": "article",
91-
"payload_type": "Symfony\\Cmf\\Bundle\\ResourceRestBundle\\Tests\\Resources\\TestBundle\\Document\\Article",
91+
"payload_type": "Symfony\\Cmf\\Bundle\\ResourceRestBundle\\Tests\\Fixtures\\App\\Document\\Article",
9292
"path": "/foo/boo",
9393
"node_name": "boo",
9494
"label": "boo",
@@ -134,7 +134,7 @@ Feature: PHPCR-ODM resource repository
134134
"repository_alias": "phpcrodm_repo",
135135
"repository_type": "doctrine/phpcr-odm",
136136
"payload_alias": "article",
137-
"payload_type": "Symfony\\Cmf\\Bundle\\ResourceRestBundle\\Tests\\Resources\\TestBundle\\Document\\Article",
137+
"payload_type": "Symfony\\Cmf\\Bundle\\ResourceRestBundle\\Tests\\Fixtures\\App\\Document\\Article",
138138
"path": "\/bar\/foo",
139139
"node_name": "foo",
140140
"label": "foo",

tests/Resources/TestBundle/Description/DummyEnhancer.php renamed to tests/Fixtures/App/Description/DummyEnhancer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Symfony\Cmf\Bundle\ResourceRestBundle\Tests\Resources\TestBundle\Description;
12+
namespace Symfony\Cmf\Bundle\ResourceRestBundle\Tests\Fixtures\App\Description;
1313

1414
use Symfony\Cmf\Component\Resource\Description\Description;
1515
use Symfony\Cmf\Component\Resource\Description\DescriptionEnhancerInterface;

0 commit comments

Comments
 (0)