forked from drevops/behat-steps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
file.feature
165 lines (154 loc) · 5.95 KB
/
file.feature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
Feature: Check that FileTrait works for or D9
@api
Scenario: Assert "Given managed file:"
When I am logged in as a user with the "administrator" role
Given managed file:
| path |
| example_document.pdf |
| example_image.png |
| example_audio.mp3 |
And managed file:
| uuid | path |
| 9cb1b484-db7b-4496-bd63-8c702e207704 | example_text.txt |
And "example_document.pdf" file object exists
And "example_image.png" file object exists
And "example_audio.mp3" file object exists
And "example_text.txt" file object exists
And "file" entity exists with UUID "9cb1b484-db7b-4496-bd63-8c702e207704"
@api
Scenario: Assert "@Given no managed files: With filename"
When I am logged in as a user with the "administrator" role
Given managed file:
| path |
| example_document.pdf |
| example_image.png |
| example_audio.mp3 |
And "example_document.pdf" file object exists
And "example_image.png" file object exists
And "example_audio.mp3" file object exists
Given no managed files:
| filename |
| example_document.pdf |
| example_image.png |
| example_audio.mp3 |
Then no "example_document.pdf" file object exists
And no "example_image.png" file object exists
And no "example_audio.mp3" file object exists
@api
Scenario: Assert "@Given no managed files: With uri"
When I am logged in as a user with the "administrator" role
Given managed file:
| path |
| example_document.pdf |
| example_image.png |
| example_audio.mp3 |
And "example_document.pdf" file object exists
And "example_image.png" file object exists
And "example_audio.mp3" file object exists
Given no managed files:
| uri |
| public://example_document.pdf |
| public://example_image.png |
| public://example_audio.mp3 |
Then no "example_document.pdf" file object exists
And no "example_image.png" file object exists
And no "example_audio.mp3" file object exists
@api
Scenario: Assert "@Given no managed files: With status"
When I am logged in as a user with the "administrator" role
Given managed file:
| path |
| example_document.pdf |
| example_image.png |
| example_audio.mp3 |
And "example_document.pdf" file object exists
And "example_image.png" file object exists
And "example_audio.mp3" file object exists
Given no managed files:
| status |
| 1 |
Then no "example_document.pdf" file object exists
And no "example_image.png" file object exists
And no "example_audio.mp3" file object exists
@api
Scenario: Assert "@Given no managed files: With filemime"
When I am logged in as a user with the "administrator" role
Given managed file:
| path |
| example_document.pdf |
| example_image.png |
| example_audio.mp3 |
And "example_document.pdf" file object exists
And "example_image.png" file object exists
And "example_audio.mp3" file object exists
Given no managed files:
| filemime |
| image/png |
And "example_document.pdf" file object exists
And no "example_image.png" file object exists
And "example_audio.mp3" file object exists
@api
Scenario: Assert unmanaged files step definitions
Given unmanaged file "public://test1.txt" does not exist
When unmanaged file "public://test1.txt" created
Then unmanaged file "public://test1.txt" exists
Then unmanaged file "public://test2.txt" does not exist
Given unmanaged file "public://test3.txt" does not exist
When unmanaged file "public://test3.txt" created with content "test content"
Then unmanaged file "public://test3.txt" exists
And unmanaged file "public://test3.txt" has content "test content"
And unmanaged file "public://test3.txt" has content "content"
And unmanaged file "public://test3.txt" does not have content "test more content"
@trait:FileTrait
Scenario: Assert that negative assertions fail with an error
Given some behat configuration
And scenario steps:
"""
Given unmanaged file "public://test4.txt" exists
"""
When I run "behat --no-colors"
Then it should fail with an error:
"""
The file public://test4.txt does not exist.
"""
@trait:FileTrait
Scenario: Assert that negative assertions fail with an error
Given some behat configuration
And scenario steps:
"""
Given unmanaged file "public://test1.txt" created
Then unmanaged file "public://test1.txt" does not exist
"""
When I run "behat --no-colors"
Then it should fail with an error:
"""
The file public://test1.txt exists but it should not.
"""
@trait:FileTrait
Scenario: Assert that negative assertions fail with an error
Given some behat configuration
And scenario steps:
"""
Given unmanaged file "public://test1.txt" created with content "test content"
Then unmanaged file "public://test1.txt" exists
And unmanaged file "public://test1.txt" has content "test other content"
"""
When I run "behat --no-colors"
Then it should fail with an error:
"""
File contents "test content" does not contain "test other content".
"""
@trait:FileTrait
Scenario: Assert that negative assertions fail with an error
Given some behat configuration
And scenario steps:
"""
Given unmanaged file "public://test1.txt" created with content "test content"
Then unmanaged file "public://test1.txt" exists
And unmanaged file "public://test1.txt" does not have content "test content"
"""
When I run "behat --no-colors"
Then it should fail with an error:
"""
File contents "test content" contains "test content", but should not.
"""