-
Notifications
You must be signed in to change notification settings - Fork 70
Expand file tree
/
Copy pathdb-columns.feature
More file actions
64 lines (56 loc) · 4.05 KB
/
db-columns.feature
File metadata and controls
64 lines (56 loc) · 4.05 KB
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
Feature: Display information about a given table.
# This requires conditional tags to target different DB versions, as bigint(20) is only bigint on MySQL 8.
@broken
Scenario: Display information about the wp_posts table
Given a WP install
When I run `wp db columns wp_posts --format=table`
Then STDOUT should be a table containing rows:
| Field | Type | Null | Key | Default | Extra |
| ID | bigint(20) unsigned | NO | PRI | | auto_increment |
| post_author | bigint(20) unsigned | NO | MUL | 0 | |
| post_date | datetime | NO | | 0000-00-00 00:00:00 | |
| post_date_gmt | datetime | NO | | 0000-00-00 00:00:00 | |
| post_content | longtext | NO | | | |
| post_title | text | NO | | | |
| post_excerpt | text | NO | | | |
| post_status | varchar(20) | NO | | publish | |
| comment_status | varchar(20) | NO | | open | |
| ping_status | varchar(20) | NO | | open | |
| post_password | varchar(255) | NO | | | |
| post_name | varchar(200) | NO | MUL | | |
| to_ping | text | NO | | | |
| pinged | text | NO | | | |
| post_modified | datetime | NO | | 0000-00-00 00:00:00 | |
| post_modified_gmt | datetime | NO | | 0000-00-00 00:00:00 | |
| post_content_filtered | longtext | NO | | | |
| post_parent | bigint(20) unsigned | NO | MUL | 0 | |
| guid | varchar(255) | NO | | | |
| menu_order | int(11) | NO | | 0 | |
| post_type | varchar(20) | NO | MUL | post | |
| post_mime_type | varchar(100) | NO | | | |
| comment_count | bigint(20) | NO | | 0 | |
Scenario: Display information about non-existing table
Given a WP install
When I try `wp db columns wp_foobar`
Then STDERR should contain:
"""
Couldn't find any tables matching: wp_foobar
"""
@require-mysql-or-mariadb
Scenario: Display information about a non default WordPress table
Given a WP install
And I run `wp db query "CREATE TABLE not_wp ( date DATE NOT NULL, awesome_stuff TEXT, PRIMARY KEY (date) );;"`
When I try `wp db columns not_wp`
Then STDOUT should be a table containing rows:
| Field | Type | Null | Key | Default | Extra |
| date | date | NO | PRI | | |
| awesome_stuff | text | YES | | | |
@require-sqlite
Scenario: Display information about a non default WordPress table
Given a WP install
And I run `wp db query "CREATE TABLE not_wp ( date DATE NOT NULL, awesome_stuff TEXT, PRIMARY KEY (date) );;"`
When I try `wp db columns not_wp`
Then STDOUT should be a table containing rows:
| Field | Type | Null | Key | Default |
| date | TEXT | NO | PRI | '' |
| awesome_stuff | TEXT | YES | | |