@@ -260,3 +260,163 @@ Feature: Validate checksums for WordPress install
260260 Error: WordPress installation doesn't verify against checksums.
261261 """
262262 And the return code should be 1
263+
264+ @require-php-7.0
265+ Scenario : Verify core checksums with format parameter - success case
266+ Given a WP install
267+
268+ When I run `wp core update`
269+ Then STDOUT should not be empty
270+
271+ When I run `wp core verify-checksums --format=json`
272+ Then STDOUT should be:
273+ """
274+ Success: WordPress installation verifies against checksums.
275+ """
276+ And the return code should be 0
277+
278+ When I run `wp core verify-checksums --format=table`
279+ Then STDOUT should be:
280+ """
281+ Success: WordPress installation verifies against checksums.
282+ """
283+ And the return code should be 0
284+
285+ Scenario : Verify core checksums with format parameter - error cases
286+ Given a WP install
287+ And "WordPress" replaced with "Wordpress" in the readme.html file
288+
289+ When I try `wp core verify-checksums --format=json`
290+ Then STDOUT should contain:
291+ """
292+ {"file":"readme.html","message":"File doesn't verify against checksum"}
293+ """
294+ And STDERR should be:
295+ """
296+ Error: WordPress installation doesn't verify against checksums.
297+ """
298+ And the return code should be 1
299+
300+ When I try `wp core verify-checksums --format=table`
301+ Then STDOUT should contain:
302+ """
303+ readme.html
304+ """
305+ And STDOUT should contain:
306+ """
307+ File doesn't verify against checksum
308+ """
309+ And STDERR should be:
310+ """
311+ Error: WordPress installation doesn't verify against checksums.
312+ """
313+ And the return code should be 1
314+
315+ Scenario : Verify core checksums with format parameter - missing and extra files
316+ Given a WP install
317+ And a wp-includes/extra-file.txt file:
318+ """
319+ hello world
320+ """
321+
322+ When I run `rm readme.html`
323+ Then STDERR should be empty
324+
325+ When I try `wp core verify-checksums --format=csv`
326+ Then STDOUT should contain:
327+ """
328+ file,message
329+ """
330+ And STDOUT should contain:
331+ """
332+ readme.html,"File doesn't exist"
333+ """
334+ And STDOUT should contain:
335+ """
336+ wp-includes/extra-file.txt,"File should not exist"
337+ """
338+ And STDERR should be:
339+ """
340+ Error: WordPress installation doesn't verify against checksums.
341+ """
342+ And the return code should be 1
343+
344+ Scenario : Verify core checksums with format parameter - yaml format
345+ Given a WP install
346+ And "WordPress" replaced with "PressWord" in the readme.html file
347+
348+ When I try `wp core verify-checksums --format=yaml`
349+ Then STDOUT should contain:
350+ """
351+ ---
352+ """
353+ And STDOUT should contain:
354+ """
355+ file: readme.html
356+ """
357+ And STDOUT should contain:
358+ """
359+ message: "File doesn't verify against checksum"
360+ """
361+ And STDERR should be:
362+ """
363+ Error: WordPress installation doesn't verify against checksums.
364+ """
365+ And the return code should be 1
366+
367+ Scenario : Verify core checksums with format parameter - count format
368+ Given a WP install
369+ And "WordPress" replaced with "PressWord" in the readme.html file
370+ And a wp-includes/extra-file.txt file:
371+ """
372+ hello world
373+ """
374+
375+ When I try `wp core verify-checksums --format=count`
376+ Then STDOUT should be:
377+ """
378+ 2
379+ """
380+ And STDERR should be:
381+ """
382+ Error: WordPress installation doesn't verify against checksums.
383+ """
384+ And the return code should be 1
385+
386+ Scenario : Verify core checksums with format parameter and exclude functionality
387+ Given a WP install
388+ And "WordPress" replaced with "PressWord" in the readme.html file
389+ And a wp-includes/extra-file.txt file:
390+ """
391+ hello world
392+ """
393+
394+ When I try `wp core verify-checksums --format=json --exclude='readme.html' `
395+ Then STDOUT should contain:
396+ """
397+ {"file":"wp-includes/extra-file.txt","message":"File should not exist"}
398+ """
399+ And STDOUT should not contain:
400+ """
401+ readme.html
402+ """
403+ And STDERR should be:
404+ """
405+ Error: WordPress installation doesn't verify against checksums.
406+ """
407+ And the return code should be 1
408+
409+ When I try `wp core verify-checksums --format=table --exclude='wp-includes/extra-file.txt' `
410+ Then STDOUT should contain:
411+ """
412+ readme.html
413+ """
414+ And STDOUT should not contain:
415+ """
416+ wp-includes/extra-file.txt
417+ """
418+ And STDERR should be:
419+ """
420+ Error: WordPress installation doesn't verify against checksums.
421+ """
422+ And the return code should be 1
0 commit comments