|
21 | 21 | */ |
22 | 22 | final class CookieTest extends TestCase { |
23 | 23 |
|
24 | | - /** |
25 | | - * Set cookie. |
26 | | - * |
27 | | - * @runInSeparateProcess |
28 | | - * |
29 | | - * @since 1.1.3 |
30 | | - * |
31 | | - * @return void |
32 | | - */ |
33 | | - public function testSetCookie() { |
34 | 24 |
|
35 | | - $this->assertTrue(Cookie::set('cookie_name', 'value', 365)); |
36 | | - } |
37 | | - |
38 | | - /** |
39 | | - * Get item from cookie. |
40 | | - * |
41 | | - * @runInSeparateProcess |
42 | | - * |
43 | | - * @since 1.1.3 |
44 | | - * |
45 | | - * @return void |
46 | | - */ |
47 | | - public function testGetCookie() { |
48 | | - |
49 | | - $_COOKIE[Cookie::$prefix . 'cookie_name'] = 'value'; |
50 | | - |
51 | | - $this->assertContains(Cookie::get('cookie_name'), 'value'); |
52 | | - } |
53 | | - |
54 | | - /** |
55 | | - * Return cookies array. |
56 | | - * |
57 | | - * @runInSeparateProcess |
58 | | - * |
59 | | - * @since 1.1.3 |
60 | | - * |
61 | | - * @return void |
62 | | - */ |
63 | | - public function testGetAllCookies() { |
64 | | - |
65 | | - $_COOKIE[Cookie::$prefix . 'cookie_name_one'] = 'value'; |
66 | | - $_COOKIE[Cookie::$prefix . 'cookie_name_two'] = 'value'; |
67 | | - |
68 | | - $this->assertArrayHasKey( |
69 | | - |
70 | | - Cookie::$prefix . 'cookie_name_two', |
71 | | - Cookie::get() |
72 | | - ); |
73 | | - } |
74 | | - |
75 | | - /** |
76 | | - * Return cookies array non-existent. |
77 | | - * |
78 | | - * @runInSeparateProcess |
79 | | - * |
80 | | - * @since 1.1.3 |
81 | | - * |
82 | | - * @return void |
83 | | - */ |
84 | | - public function testGetAllCookiesNonExistents() { |
85 | | - |
86 | | - $this->assertFalse(Cookie::get()); |
87 | | - } |
88 | | - |
89 | | - /** |
90 | | - * Extract item from cookie then delete cookie and return the item. |
91 | | - * |
92 | | - * @runInSeparateProcess |
93 | | - * |
94 | | - * @since 1.1.3 |
95 | | - * |
96 | | - * @return void |
97 | | - */ |
98 | | - public function testPullCookie() { |
99 | | - |
100 | | - $_COOKIE[Cookie::$prefix . 'cookie_name'] = 'value'; |
101 | | - |
102 | | - $this->assertContains(Cookie::pull('cookie_name'), 'value'); |
103 | | - } |
104 | | - |
105 | | - /** |
106 | | - * Extract item from cookie non-existent. |
107 | | - * |
108 | | - * @runInSeparateProcess |
109 | | - * |
110 | | - * @since 1.1.3 |
111 | | - * |
112 | | - * @return void |
113 | | - */ |
114 | | - public function testPullCookieNonExistent() { |
115 | | - |
116 | | - $this->assertFalse(Cookie::pull('cookie_name')); |
117 | | - } |
118 | | - |
119 | | - /** |
120 | | - * Destroy one cookie. |
121 | | - * |
122 | | - * @runInSeparateProcess |
123 | | - * |
124 | | - * @since 1.1.3 |
125 | | - * |
126 | | - * @return void |
127 | | - */ |
128 | | - public function testDestroyOneCookie() { |
129 | | - |
130 | | - $_COOKIE[Cookie::$prefix . 'cookie_name'] = 'value'; |
131 | | - |
132 | | - $this->assertTrue(Cookie::destroy('cookie_name')); |
133 | | - } |
134 | | - |
135 | | - /** |
136 | | - * Destroy one cookie non-existent. |
137 | | - * |
138 | | - * @runInSeparateProcess |
139 | | - * |
140 | | - * @since 1.1.3 |
141 | | - * |
142 | | - * @return void |
143 | | - */ |
144 | | - public function testDestroyOneCookieNonExistent() { |
145 | | - |
146 | | - $this->assertFalse(Cookie::destroy('cookie_name')); |
147 | | - } |
148 | | - |
149 | | - /** |
150 | | - * Destroy all cookies. |
151 | | - * |
152 | | - * @runInSeparateProcess |
153 | | - * |
154 | | - * @since 1.1.3 |
155 | | - * |
156 | | - * @return void |
157 | | - */ |
158 | | - public function testDestroyAllCookies() { |
159 | | - |
160 | | - $_COOKIE[Cookie::$prefix . 'cookie_name_one'] = 'value'; |
161 | | - $_COOKIE[Cookie::$prefix . 'cookie_name_two'] = 'value'; |
162 | | - |
163 | | - $this->assertTrue(Cookie::destroy()); |
164 | | - } |
165 | | - |
166 | | - /** |
167 | | - * Destroy all cookies non-existents. |
168 | | - * |
169 | | - * @runInSeparateProcess |
170 | | - * |
171 | | - * @since 1.1.3 |
172 | | - * |
173 | | - * @return void |
174 | | - */ |
175 | | - public function testDestroyAllCookiesNonExistents() { |
176 | | - |
177 | | - $this->assertFalse(Cookie::destroy()); |
178 | | - } |
179 | 25 | } |
0 commit comments