-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathlang.feature
112 lines (99 loc) · 3.06 KB
/
lang.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
@pll-lang
Feature: Manage Polylang languages
Background:
Given a WP install
And an empty cache
And I run `wp core version`
And save STDOUT as {WP_VERSION}
And I run `wp plugin install polylang`
And I run `wp plugin activate polylang`
And I run `wp pll lang create Dutch nl nl_NL`
And I run `wp pll doctor translate`
@core-language
Scenario: Language CRUD commands
When I run `wp pll lang create afrikaans af af`
Then STDOUT should contain:
"""
Success: Language added.
Downloading translation from https://downloads.wordpress.org/translation/core/{WP_VERSION}/af.zip...
Unpacking the update...
Installing the latest version...
Translation updated successfully.
Success: Language installed.
"""
When I try `wp pll lang create Nederlands nl nl_NL`
Then STDERR should be:
"""
Error: The language code must be unique
"""
When I try `wp pll lang create "Nederlands (BE)" nl-be nl_NL`
Then STDOUT should contain:
"""
Success: Language added.
"""
And STDERR should be:
"""
Warning: Language 'nl_NL' already installed.
"""
And the return code should be 0
When I try `wp pll lang create Klingon klingon tlh`
Then STDOUT should contain:
"""
Success: Language added.
"""
And STDERR should be:
"""
Error: Language 'tlh' not found.
"""
And the return code should be 0
When I run `wp pll lang get nl --format=json`
Then STDOUT should contain:
"""
{"term_id":2,"name":"Dutch","slug":"nl","term_group":0,"term_taxonomy_id":2,"taxonomy":"language","description":"a:3:{s:6:\"locale\";s:5:\"nl_NL\";s:3:\"rtl\";i:0;s:9:\"flag_code\";s:0:\"\";}","parent":0,"count":2,"filter":"raw"}
"""
When I run `wp pll lang url nl-be`
Then STDOUT should contain:
"""
http://example.com/?lang=nl-be
"""
When I run `wp pll lang url nl`
Then STDOUT should contain:
"""
http://example.com/
"""
When I run `wp pll option update hide_default 0`
And I run `wp pll lang url nl`
Then STDOUT should contain:
"""
http://example.com/?lang=nl
"""
When I run `wp pll lang delete klingon`
Then STDOUT should contain:
"""
Success: Language deleted. klingon (tlh)
Success: 1 of 1 languages deleted
"""
And STDERR should be:
"""
Error: Language not installed.
"""
When I run `wp pll lang delete --all --keep_default`
Then STDOUT should contain:
"""
Notice: Keeping default language nl (nl_NL).
Success: Language deleted. af (af)
Success: Language uninstalled.
Success: Language deleted. nl-be (nl_NL)
"""
And STDERR should be:
"""
Warning: 2 of 3 languages deleted
"""
And the return code should be 0
When I run `wp pll lang delete --all`
Then STDOUT should contain:
"""
Success: Language deleted. nl (nl_NL)
Success: Language uninstalled.
Success: 1 of 1 languages deleted
"""