Skip to content

Commit 4ba36f3

Browse files
committed
Merge branch '2.2' into master
2 parents fb05629 + 8101201 commit 4ba36f3

File tree

4 files changed

+99
-6
lines changed

4 files changed

+99
-6
lines changed

.travis.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,27 @@ matrix:
3030
- SYMFONY_CMD="ez:behat:create-language 'pol-PL' 'Polish (polski)'"
3131
- USER_RUNNING_TESTS=root
3232
- PHP_IMAGE=ezsystems/php:7.3-v1
33-
- name: "PHP 7.3 Symfony Cache tests"
33+
- name: "PHP 7.3 Symfony Cache integration tests"
3434
php: 7.3
3535
env:
36-
- TEST_CMD="bin/ezbehat --profile=httpCache --suite=symfonycache"
36+
- TEST_CMD="bin/ezbehat --mode=standard --profile=httpCache --suite=symfonycache"
37+
- WEB_HOST="web"
3738
- APP_DEBUG=1
39+
- name: "PHP 7.3 Varnish integration tests"
40+
php: 7.3
41+
env:
42+
- TEST_CMD="bin/ezbehat --mode=standard --profile=httpCache --suite=varnish"
43+
- APP_DEBUG=1
44+
- WEB_HOST=varnish
45+
- COMPOSE_FILE="doc/docker/base-dev.yml:doc/docker/varnish.yml:doc/docker/selenium.yml"
46+
- name: "PHP 7.3 Varnish integration tests with invalidate token"
47+
php: 7.3
48+
env:
49+
- TEST_CMD="bin/ezbehat --mode=standard --profile=httpCache --suite=varnish"
50+
- HTTPCACHE_VARNISH_INVALIDATE_TOKEN=TESTTOKEN
51+
- APP_DEBUG=1
52+
- WEB_HOST=varnish
53+
- COMPOSE_FILE="doc/docker/base-dev.yml:doc/docker/varnish.yml:doc/docker/selenium.yml"
3854

3955
# test only master + stable (+ Pull requests)
4056
branches:

behat_suites.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,20 @@ httpCache:
1616
- EzSystems\Behat\Browser\Context\Hooks
1717
- EzSystems\Behat\Browser\Context\FrontendContext:
1818
argumentParser: '@EzSystems\Behat\Core\Behat\ArgumentParser'
19+
varnish:
20+
paths:
21+
- '%paths.base%/vendor/ezsystems/ezplatform-http-cache/features/varnish'
22+
filters:
23+
tags: '@varnish'
24+
contexts:
25+
- EzSystems\Behat\API\Context\TestContext:
26+
userService: '@ezpublish.api.service.user'
27+
permissionResolver: '@eZ\Publish\API\Repository\PermissionResolver'
28+
- EzSystems\Behat\Core\Context\TimeContext
29+
- EzSystems\Behat\API\Context\ContentContext:
30+
contentFacade: '@EzSystems\Behat\API\Facade\ContentFacade'
31+
argumentParser: '@EzSystems\Behat\Core\Behat\ArgumentParser'
32+
- EzSystems\Behat\Browser\Context\BrowserContext
33+
- EzSystems\Behat\Browser\Context\Hooks
34+
- EzSystems\Behat\Browser\Context\FrontendContext:
35+
argumentParser: '@EzSystems\Behat\Core\Behat\ArgumentParser'

features/symfony/cache.feature

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ Feature: As an site administrator I want my pages to be cached using Symfony Htt
1919

2020

2121
Examples:
22-
| user | itemName | headerValue |
23-
| admin | TestFolderShortNameAdmin | GET /site/testfoldershortnameadmin: fresh |
24-
| anonymous | TestFolderShortNameAnonymous | GET /site/testfoldershortnameanonymous: fresh |
22+
| user | password | itemName | headerValue |
23+
| admin | publish | TestFolderShortNameAdmin | GET /site/testfoldershortnameadmin: fresh |
24+
| anonymous | | TestFolderShortNameAnonymous | GET /site/testfoldershortnameanonymous: fresh |
2525

2626
@admin
2727
Scenario Outline: Cache is refreshed when item is edited
@@ -47,6 +47,6 @@ Feature: As an site administrator I want my pages to be cached using Symfony Htt
4747
| X-Symfony-Cache | <headerValue> |
4848

4949
Examples:
50-
| user | password | itemName | itemNameAfterEdit | headerValue |
50+
| user | password | itemName | itemNameAfterEdit | headerValue |
5151
| admin | publish | NameToEditAdmin | NameEditedAdmin | GET /site/nameeditedadmin: fresh |
5252
| anonymous | | NameToEditAnon | NameEditedAnon | GET /site/nameeditedanon: fresh |

features/varnish/cache.feature

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
@varnish
2+
Feature: As an site administrator I want my pages to be cached using Varnish
3+
4+
@admin
5+
Scenario Outline: Content Items are cached for user when visited
6+
Given I create "Folder" Content items in root in "eng-GB"
7+
| name | short_name |
8+
| TestFolder | <itemName> |
9+
And I am viewing the pages on siteaccess "site" as "<user>"
10+
When I visit <itemName> on siteaccess "site"
11+
And response headers contain
12+
| Header | Value |
13+
| X-Cache | MISS |
14+
And I reload the page
15+
Then I see correct preview data for "Folder" Content Type
16+
| field | value |
17+
| title | <itemName> |
18+
And response headers contain
19+
| Header | Value |
20+
| X-Cache | HIT |
21+
22+
Examples:
23+
| user | password | itemName |
24+
| admin | publish | TestFolderShortNameAdmin |
25+
| anonymous | | TestFolderShortNameAnonymous |
26+
27+
@admin
28+
Scenario Outline: Cache is refreshed when item is edited
29+
Given I create "Folder" Content items in root in "eng-GB"
30+
| name | short_name |
31+
| TestFolder | <itemName> |
32+
And I am viewing the pages on siteaccess "site" as "<user>" "<password>"
33+
And I visit "<itemName>" on siteaccess "site"
34+
And I reload the page
35+
And I see correct preview data for "Folder" Content Type
36+
| field | value |
37+
| title | <itemName> |
38+
And response headers contain
39+
| Header | Value |
40+
| X-Cache | HIT |
41+
When I edit "<itemName>" Content item in "eng-GB"
42+
| short_name |
43+
| <itemNameAfterEdit> |
44+
And I reload the page
45+
# Give Varnish time to fetch the backend response
46+
And I wait 5 seconds
47+
# Second reload is needed because of soft purging
48+
And I reload the page
49+
And I reload the page
50+
Then I see correct preview data for "Folder" Content Type
51+
| field | value |
52+
| title | <itemNameAfterEdit> |
53+
And response headers contain
54+
| Header | Value |
55+
| X-Cache | HIT |
56+
57+
Examples:
58+
| user | password | itemName | itemNameAfterEdit |
59+
| admin | publish | NameToEditAdmin | NameEditedAdmin |
60+
| anonymous | | NameToEditAnon | NameEditedAnon |

0 commit comments

Comments
 (0)