Commit 6af88f5
[Cypress] PHP Backend Notice com_media/Files (joomla#44976)
* [Cypress] PHP Backend Notice com_media/Files.cy.js
Fixing all Joomla backend PHP notices from Cypress test file `api/com_media/Files.cy.js` and doing some refactoring.
Fixed PHP notices are:
```
[Sat Feb 22 18:28:44.019593 2025] [php:notice] [pid 31:tid 31] [client 10.0.0.1:64714] PHP Notice: exif_imagetype(): Error reading from /var/www/html/files/test-image-1.jpg! in /var/www/html/libraries/src/Helper/MediaHelper.php on line 93
[Sat Feb 22 18:28:44.022074 2025] [php:notice] [pid 31:tid 31] [client 10.0.0.1:64714] PHP Notice: getimagesize(): Error reading from /var/www/html/files/test-image-1.jpg! in /var/www/html/libraries/src/Image/Image.php on line 177
[Sat Feb 22 18:28:44.258619 2025] [php:notice] [pid 31:tid 31] [client 10.0.0.1:64714] PHP Notice: exif_imagetype(): Error reading from /var/www/html/files/test-dir/test-image-1-subfolder.jpg! in /var/www/html/libraries/src/Helper/MediaHelper.php on line 93
[Sat Feb 22 18:28:44.259092 2025] [php:notice] [pid 31:tid 31] [client 10.0.0.1:64714] PHP Notice: getimagesize(): Error reading from /var/www/html/files/test-dir/test-image-1-subfolder.jpg! in /var/www/html/libraries/src/Image/Image.php on line 177
[Sat Feb 22 18:28:47.177357 2025] [php:notice] [pid 31:tid 31] [client 10.0.0.1:64714] PHP Notice: exif_imagetype(): Error reading from /var/www/html/files/test-dir/todelete.jpg! in /var/www/html/libraries/src/Helper/MediaHelper.php on line 93
[Sat Feb 22 18:28:47.178099 2025] [php:notice] [pid 31:tid 31] [client 10.0.0.1:64714] PHP Notice: getimagesize(): Error reading from /var/www/html/files/test-dir/todelete.jpg! in /var/www/html/libraries/src/Image/Image.php on line 177
[Sat Feb 22 18:28:47.564807 2025] [php:notice] [pid 31:tid 31] [client 10.0.0.1:64714] PHP Notice: exif_imagetype(): Error reading from /var/www/html/images/test-dir/todelete.jpg! in /var/www/html/libraries/src/Helper/MediaHelper.php on line 93
[Sat Feb 22 18:28:47.565288 2025] [php:notice] [pid 31:tid 31] [client 10.0.0.1:64714] PHP Notice: getimagesize(): Error reading from /var/www/html/images/test-dir/todelete.jpg! in /var/www/html/libraries/src/Image/Image.php on line 177
```
All 8 x PHP notices are fixed. Instead of using 1-Byte files real images are used from Cypress fixtures.
Please consider there are still 4 x PHP warning to be fixed (I assume they need to be fixed in PHP API backend code) from `api/com_media/Files.cy.js` and more warnings and notices in the overall Joomla System Tests.
Some refactoring:
* Deleted 3 images in `tests/System/data/com_media`, 2 are not used and Cypress default is to use `fixtures` folder
* The image file names are counted through and the images show name and path in different colors.
* Second `test-dir` was named `test-dir2` to distinguish clearly.
* `afterEach()` is reduced to `after()`, as it is only a clean-up and not needed to execute the tests.
* The last 4 tests can use the prepared files too, as with `beforeEach` the files are restored before each test.
* Corrected Image Description to test-dir2
Used command:
```
convert -size 100x100 -gravity center -pointsize 11 xc:lightgreen -fill red -annotate +0+0 'Joomla\nSystem Tests\n\nimages/test-dir2\ntest-image-3.jpg' tests/System/fixtures/com_media/test-image-3.jpg
```
* Fix for Windows Path and Read-Only Overwrites
- Creating relative fixtures folder path now also works on Windows with backslashes as separators and a drive letter
- All overwrite files are now created with explicit read-write 0o666, as the default 0o444 creates read-only files, leading to PHP Warnings `Failed to open`
---------
Co-authored-by: Allon Moritz <[email protected]>
Co-authored-by: Robert Deutz <[email protected]>1 parent 4c6bb85 commit 6af88f5
File tree
7 files changed
+46
-38
lines changed- tests/System
- data/com_media
- fixtures/com_media
- integration/api/com_media
7 files changed
+46
-38
lines changedBinary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Loading
Loading
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
3 | 12 | | |
4 | | - | |
5 | | - | |
| 13 | + | |
6 | 14 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
12 | 23 | | |
| 24 | + | |
13 | 25 | | |
14 | 26 | | |
15 | 27 | | |
| |||
23 | 35 | | |
24 | 36 | | |
25 | 37 | | |
26 | | - | |
| 38 | + | |
27 | 39 | | |
28 | 40 | | |
29 | 41 | | |
| |||
61 | 73 | | |
62 | 74 | | |
63 | 75 | | |
64 | | - | |
| 76 | + | |
65 | 77 | | |
66 | 78 | | |
67 | 79 | | |
| |||
86 | 98 | | |
87 | 99 | | |
88 | 100 | | |
89 | | - | |
90 | | - | |
| 101 | + | |
| 102 | + | |
91 | 103 | | |
92 | 104 | | |
93 | 105 | | |
94 | 106 | | |
95 | 107 | | |
96 | 108 | | |
97 | | - | |
| 109 | + | |
98 | 110 | | |
99 | 111 | | |
100 | 112 | | |
101 | 113 | | |
102 | | - | |
| 114 | + | |
103 | 115 | | |
104 | 116 | | |
105 | 117 | | |
106 | 118 | | |
107 | 119 | | |
108 | 120 | | |
109 | | - | |
| 121 | + | |
110 | 122 | | |
111 | 123 | | |
112 | 124 | | |
113 | 125 | | |
114 | | - | |
115 | | - | |
| 126 | + | |
| 127 | + | |
116 | 128 | | |
117 | 129 | | |
118 | 130 | | |
| |||
127 | 139 | | |
128 | 140 | | |
129 | 141 | | |
130 | | - | |
| 142 | + | |
131 | 143 | | |
132 | 144 | | |
133 | 145 | | |
| |||
140 | 152 | | |
141 | 153 | | |
142 | 154 | | |
143 | | - | |
144 | | - | |
| 155 | + | |
| 156 | + | |
145 | 157 | | |
146 | | - | |
147 | | - | |
| 158 | + | |
| 159 | + | |
148 | 160 | | |
149 | 161 | | |
150 | 162 | | |
151 | 163 | | |
152 | 164 | | |
153 | 165 | | |
154 | | - | |
| 166 | + | |
155 | 167 | | |
156 | 168 | | |
157 | 169 | | |
158 | 170 | | |
159 | | - | |
160 | | - | |
| 171 | + | |
| 172 | + | |
161 | 173 | | |
162 | 174 | | |
163 | 175 | | |
164 | 176 | | |
165 | 177 | | |
166 | 178 | | |
167 | | - | |
| 179 | + | |
168 | 180 | | |
169 | 181 | | |
170 | 182 | | |
171 | | - | |
172 | | - | |
173 | | - | |
| 183 | + | |
| 184 | + | |
174 | 185 | | |
175 | 186 | | |
176 | | - | |
177 | | - | |
178 | | - | |
| 187 | + | |
| 188 | + | |
179 | 189 | | |
180 | 190 | | |
181 | | - | |
182 | | - | |
183 | | - | |
| 191 | + | |
| 192 | + | |
184 | 193 | | |
185 | 194 | | |
186 | | - | |
187 | | - | |
188 | | - | |
| 195 | + | |
| 196 | + | |
189 | 197 | | |
190 | 198 | | |
0 commit comments