|
| 1 | +Feature: Perform database operations with SQLite |
| 2 | + |
| 3 | + @require-sqlite |
| 4 | + Scenario: SQLite DB CRUD operations |
| 5 | + Given a WP install with SQLite |
| 6 | + And a session_yes file: |
| 7 | + """ |
| 8 | + y |
| 9 | + """ |
| 10 | + |
| 11 | + When I run `wp db create` |
| 12 | + Then the return code should be 1 |
| 13 | + And STDERR should contain: |
| 14 | + """ |
| 15 | + Database already exists |
| 16 | + """ |
| 17 | + |
| 18 | + When I run `wp db size` |
| 19 | + Then STDOUT should contain: |
| 20 | + """ |
| 21 | + .ht.sqlite |
| 22 | + """ |
| 23 | + |
| 24 | + When I run `wp db tables` |
| 25 | + Then STDOUT should contain: |
| 26 | + """ |
| 27 | + wp_posts |
| 28 | + """ |
| 29 | + |
| 30 | + @require-sqlite |
| 31 | + Scenario: SQLite DB query |
| 32 | + Given a WP install with SQLite |
| 33 | + |
| 34 | + When I run `wp db query 'SELECT COUNT(*) as total FROM wp_posts'` |
| 35 | + Then STDOUT should contain: |
| 36 | + """ |
| 37 | + total |
| 38 | + """ |
| 39 | + |
| 40 | + @require-sqlite |
| 41 | + Scenario: SQLite DB export/import |
| 42 | + Given a WP install with SQLite |
| 43 | + |
| 44 | + When I run `wp post list --format=count` |
| 45 | + Then STDOUT should contain: |
| 46 | + """ |
| 47 | + 1 |
| 48 | + """ |
| 49 | + |
| 50 | + When I run `wp db export /tmp/wp-cli-sqlite-behat.sql` |
| 51 | + Then STDOUT should contain: |
| 52 | + """ |
| 53 | + Success: Exported |
| 54 | + """ |
| 55 | + |
| 56 | + When I run `wp db reset < session_yes` |
| 57 | + Then STDOUT should contain: |
| 58 | + """ |
| 59 | + Success: Database reset |
| 60 | + """ |
| 61 | +
|
| 62 | + When I run `wp db import /tmp/wp-cli-sqlite-behat.sql` |
| 63 | + Then STDOUT should contain: |
| 64 | + """ |
| 65 | + Success: Imported |
| 66 | + """ |
| 67 | +
|
| 68 | + When I run `wp post list --format=count` |
| 69 | + Then STDOUT should contain: |
| 70 | + """ |
| 71 | + 1 |
| 72 | + """ |
| 73 | +
|
| 74 | + @require-sqlite |
| 75 | + Scenario: SQLite commands that show warnings |
| 76 | + Given a WP install with SQLite |
| 77 | +
|
| 78 | + When I run `wp db check` |
| 79 | + Then STDOUT should contain: |
| 80 | + """ |
| 81 | + Warning: Database check is not supported for SQLite databases |
| 82 | + """ |
| 83 | +
|
| 84 | + When I run `wp db optimize` |
| 85 | + Then STDOUT should contain: |
| 86 | + """ |
| 87 | + Warning: Database optimization is not supported for SQLite databases |
| 88 | + """ |
| 89 | +
|
| 90 | + When I run `wp db repair` |
| 91 | + Then STDOUT should contain: |
| 92 | + """ |
| 93 | + Warning: Database repair is not supported for SQLite databases |
| 94 | + """ |
| 95 | +
|
| 96 | + When I run `wp db cli` |
| 97 | + Then STDOUT should contain: |
| 98 | + """ |
| 99 | + Warning: Interactive console (cli) is not supported for SQLite databases |
| 100 | + """ |
0 commit comments