File tree Expand file tree Collapse file tree 11 files changed +140
-11
lines changed
src/Bridge/Doctrine/Common
Fixtures/TestBundle/Entity Expand file tree Collapse file tree 11 files changed +140
-11
lines changed Original file line number Diff line number Diff line change @@ -51,8 +51,8 @@ install:
51
51
52
52
script :
53
53
- vendor/bin/phpunit
54
- - if [[ $APP_ENV != 'postgres' ]]; then vendor/bin/behat --format=progress; fi
55
- - if [[ $APP_ENV = 'postgres' ]]; then vendor/bin/behat --tags='~@sqlite' --format=progress; fi
54
+ - if [[ $APP_ENV != 'postgres' ]]; then vendor/bin/behat --suite=default -- format=progress; fi
55
+ - if [[ $APP_ENV = 'postgres' ]]; then vendor/bin/behat --suite=postgres --format=progress; fi
56
56
- tests/Fixtures/app/console api:swagger:export > swagger.json && swagger-cli validate swagger.json && rm swagger.json
57
57
- if [[ $lint = 1 ]]; then php php-cs-fixer.phar fix --dry-run --diff --no-ansi; fi
58
58
- if [[ $lint = 1 ]]; then phpstan analyse -c phpstan.neon -l5 --ansi src tests; fi
Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ Coverage will be available in `coverage/index.html`.
90
90
The command to launch Behat tests is:
91
91
92
92
```
93
- ./vendor/bin/behat --stop-on-failure -vvv
93
+ ./vendor/bin/behat --suite=default -- stop-on-failure -vvv
94
94
```
95
95
96
96
You may need to clear the cache manually before running behat tests because of the temporary sql database. To do so, just remove the ` test ` cache directory:
Original file line number Diff line number Diff line change @@ -22,12 +22,12 @@ install:
22
22
- echo extension=php_mbstring.dll >> php.ini
23
23
- echo extension=php_intl.dll >> php.ini
24
24
- echo extension=php_pdo_sqlite.dll >> php.ini
25
- - echo memory_limit=1G >> php.ini
25
+ - echo memory_limit=3G >> php.ini
26
26
- cd %APPVEYOR_BUILD_FOLDER%
27
27
- php -r "readfile('http://getcomposer.org/installer');" | php
28
28
- php composer.phar install --no-interaction --no-progress
29
29
30
30
test_script :
31
31
- cd %APPVEYOR_BUILD_FOLDER%
32
- - php vendor\behat\behat\bin\behat --format=progress --tags='~@postgres'
32
+ - php vendor\behat\behat\bin\behat --format=progress --suite=default
33
33
- php vendor\phpunit\phpunit\phpunit
Original file line number Diff line number Diff line change @@ -13,6 +13,19 @@ default:
13
13
- 'Behatch\Context\RestContext'
14
14
filters:
15
15
tags: ~@postgres
16
+ postgres:
17
+ contexts:
18
+ - 'FeatureContext': { doctrine: '@doctrine' }
19
+ - 'GraphqlContext'
20
+ - 'JsonContext'
21
+ - 'HydraContext'
22
+ - 'SwaggerContext'
23
+ - 'HttpCacheContext'
24
+ - 'JsonApiContext': { doctrine: '@doctrine', jsonApiSchemaFile: 'tests/Fixtures/JsonSchema/jsonapi.json' }
25
+ - 'Behat\MinkExtension\Context\MinkContext'
26
+ - 'Behatch\Context\RestContext'
27
+ filters:
28
+ tags: ~@sqlite
16
29
extensions:
17
30
'Behat\Symfony2Extension':
18
31
kernel:
Original file line number Diff line number Diff line change @@ -305,7 +305,6 @@ Feature: Order filter on collections
305
305
Given there are 30 dummy objects
306
306
When I send a "GET" request to "/dummies?order[name]=desc&order[id]=desc"
307
307
Then the response status code should be 200
308
- Then print last JSON response
309
308
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
310
309
And the JSON should be valid according to this schema:
311
310
"""
Original file line number Diff line number Diff line change
1
+ @postgres
2
+ Feature : Expose persisted object state
3
+ In order to use an hypermedia API
4
+ As a client software developer
5
+ I need to be able to retrieve the exact state of resources after persistence.
6
+
7
+ @createSchema
8
+ Scenario : Create a resource with truncable value should return the correct object state
9
+ When I add "Content-Type" header equal to "application/ld+json"
10
+ And I send a "POST" request to "/truncated_dummies" with body:
11
+ """
12
+ {
13
+ "value": "20.3325"
14
+ }
15
+ """
16
+ Then the response status code should be 201
17
+ And the JSON should be equal to:
18
+ """
19
+ {
20
+ "@context": "/contexts/TruncatedDummy",
21
+ "@id": "/truncated_dummies/1",
22
+ "@type": "TruncatedDummy",
23
+ "value": "20.3",
24
+ "id": 1
25
+ }
26
+ """
27
+
28
+ @dropSchema
29
+ Scenario : Update a resource with truncable value value should return the correct object state
30
+ When I add "Content-Type" header equal to "application/ld+json"
31
+ And I send a "PUT" request to "/truncated_dummies/1" with body:
32
+ """
33
+ {
34
+ "value": "42.42"
35
+ }
36
+ """
37
+ Then the response status code should be 200
38
+ And the JSON should be equal to:
39
+ """
40
+ {
41
+ "@context": "/contexts/TruncatedDummy",
42
+ "@id": "/truncated_dummies/1",
43
+ "@type": "TruncatedDummy",
44
+ "value": "42.4",
45
+ "id": 1
46
+ }
47
+ """
Original file line number Diff line number Diff line change @@ -72,9 +72,7 @@ Feature: Relations support
72
72
},
73
73
"relatedToDummyFriend": [],
74
74
"dummyBoolean": null,
75
- "embeddedDummy": null,
76
- "id": 1,
77
- "symfony": "symfony",
75
+ "embeddedDummy": [],
78
76
"age": null
79
77
}
80
78
"""
@@ -476,8 +474,7 @@ Feature: Relations support
476
474
},
477
475
"relatedToDummyFriend": [],
478
476
"dummyBoolean": null,
479
- "embeddedDummy": null,
480
- "symfony": "symfony",
477
+ "embeddedDummy": [],
481
478
"age": null
482
479
}
483
480
"""
Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ public function persist($data)
53
53
54
54
$ manager ->persist ($ data );
55
55
$ manager ->flush ();
56
+ $ manager ->refresh ($ data );
56
57
}
57
58
58
59
/**
Original file line number Diff line number Diff line change @@ -50,6 +50,7 @@ public function testPersist()
50
50
$ objectManagerProphecy = $ this ->prophesize (ObjectManager::class);
51
51
$ objectManagerProphecy ->persist ($ dummy )->shouldBeCalled ();
52
52
$ objectManagerProphecy ->flush ()->shouldBeCalled ();
53
+ $ objectManagerProphecy ->refresh ($ dummy )->shouldBeCalled ();
53
54
54
55
$ managerRegistryProphecy = $ this ->prophesize (ManagerRegistry::class);
55
56
$ managerRegistryProphecy ->getManagerForClass (Dummy::class)->willReturn ($ objectManagerProphecy ->reveal ())->shouldBeCalled ();
Original file line number Diff line number Diff line change @@ -78,4 +78,29 @@ public function setChildren($children)
78
78
79
79
return $ this ;
80
80
}
81
+
82
+ /**
83
+ * @param $child
84
+ *
85
+ * @return $this
86
+ */
87
+ public function addChild ($ child )
88
+ {
89
+ $ this ->children ->add ($ child );
90
+ $ child ->setParent ($ this );
91
+
92
+ return $ this ;
93
+ }
94
+
95
+ /**
96
+ * @param $child
97
+ *
98
+ * @return $this
99
+ */
100
+ public function removeChild ($ child )
101
+ {
102
+ $ this ->children ->remove ($ child );
103
+
104
+ return $ this ;
105
+ }
81
106
}
You can’t perform that action at this time.
0 commit comments