Skip to content

Commit 9145bb5

Browse files
committed
Updated to 1.1.6 version
1 parent c4a8db0 commit 9145bb5

File tree

7 files changed

+54
-54
lines changed

7 files changed

+54
-54
lines changed

.gitattributes

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ phpmd.xml export-ignore
88
.travis.yml export-ignore
99
.editorconfig export-ignore
1010
.gitattributes export-ignore
11-
.gitignore export-ignore
11+
.gitignore export-ignore
12+
.php_cs.dist export-ignore
13+
CONDUCT.md export-ignore

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# CHANGELOG
22

3+
## 1.1.6 - 2018-01-05
4+
5+
* The tests were fixed.
6+
7+
* Changes in documentation.
8+
39
## 1.1.5 - 2017-11-08
410

511
* Implemented `PHP Mess Detector` to detect inconsistencies in code styles.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
The MIT License (MIT)
22
=====================
33

4-
Copyright (c) `2016 - 2017` `Josantonius, https://josantonius.com <hello@josantonius.com>`
4+
Copyright (c) `2016 - 2018` `Josantonius, https://josantonius.com <hello@josantonius.com>`
55

66
Permission is hereby granted, free of charge, to any person obtaining a copy of
77
this software and associated documentation files (the "Software"), to deal in

README-ES.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ Ejecutar todas las pruebas anteriores:
205205
- [ ] Añadir nueva funcionalidad
206206
- [ ] Mejorar pruebas
207207
- [ ] Mejorar documentación
208-
- [ ] Refactorizar código
208+
- [ ] Refactorizar código para las reglas de estilo de código deshabilitadas. Ver [phpmd.xml](phpmd.xml) y [.php_cs.dist](.php_cs.dist)
209209

210210
## Contribuir
211211

@@ -232,7 +232,7 @@ Este proyecto está licenciado bajo **licencia MIT**. Consulta el archivo [LICEN
232232

233233
## Copyright
234234

235-
2016 - 2017 Josantonius, [josantonius.com](https://josantonius.com/)
235+
2016 - 2018 Josantonius, [josantonius.com](https://josantonius.com/)
236236

237237
Si te ha resultado útil, házmelo saber :wink:
238238

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ Run all previous tests:
205205
- [ ] Add new feature
206206
- [ ] Improve tests
207207
- [ ] Improve documentation
208-
- [ ] Refactor code
208+
- [ ] Refactor code for disabled code style rules. See [phpmd.xml](phpmd.xml) and [.php_cs.dist](.php_cs.dist)
209209

210210
## Contribute
211211

@@ -232,7 +232,7 @@ This project is licensed under **MIT license**. See the [LICENSE](LICENSE) file
232232

233233
## Copyright
234234

235-
2016 - 2017 Josantonius, [josantonius.com](https://josantonius.com/)
235+
2016 - 2018 Josantonius, [josantonius.com](https://josantonius.com/)
236236

237237
If you find it useful, let me know :wink:
238238

src/Cookie.php

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* PHP library for handling cookies.
44
*
55
* @author Josantonius <hello@josantonius.com>
6-
* @copyright 2016 - 2017 (c) Josantonius - PHP-Cookie
6+
* @copyright 2016 - 2018 (c) Josantonius - PHP-Cookie
77
* @license https://opensource.org/licenses/MIT - The MIT License (MIT)
88
* @link https://github.com/Josantonius/PHP-Cookie
99
* @since 1.0.0
@@ -20,17 +20,13 @@ class Cookie
2020
/**
2121
* Prefix for cookies.
2222
*
23-
* @since 1.0.0
24-
*
2523
* @var string
2624
*/
2725
public static $prefix = 'jst_';
2826

2927
/**
3028
* Set cookie.
3129
*
32-
* @since 1.0.0
33-
*
3430
* @param string $key → name the data to save
3531
* @param string $value → the data to save
3632
* @param string $time → expiration time in days
@@ -47,8 +43,6 @@ public static function set($key, $value, $time = 365)
4743
/**
4844
* Get item from cookie.
4945
*
50-
* @since 1.0.0
51-
*
5246
* @param string $key → item to look for in cookie
5347
*
5448
* @return mixed|false → returns cookie value, cookies array or false
@@ -65,8 +59,6 @@ public static function get($key = '')
6559
/**
6660
* Extract item from cookie then delete cookie and return the item.
6761
*
68-
* @since 1.0.0
69-
*
7062
* @param string $key → item to extract
7163
*
7264
* @return string|false → return item or false when key does not exists
@@ -85,8 +77,6 @@ public static function pull($key)
8577
/**
8678
* Empties and destroys the cookies.
8779
*
88-
* @since 1.0.0
89-
*
9080
* @param string $key → cookie name to destroy. Not set to delete all
9181
*
9282
* @return bool

tests/CookieTest.php

Lines changed: 39 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
* PHP library for handling cookies.
44
*
55
* @author Josantonius <hello@josantonius.com>
6-
* @copyright 2016 - 2017 (c) Josantonius - PHP-Cookie
6+
* @copyright 2016 - 2018 (c) Josantonius - PHP-Cookie
77
* @license https://opensource.org/licenses/MIT - The MIT License (MIT)
88
* @link https://github.com/Josantonius/PHP-Cookie
9-
* @since 1.0.0
9+
* @since 1.1.3
1010
*/
1111
namespace Josantonius\Cookie;
1212

@@ -47,152 +47,154 @@ public function setUp()
4747
parent::setUp();
4848

4949
$this->Cookie = new Cookie;
50-
$this->cookiePrefix = $this->Cookie->getCookiePrefix();
50+
51+
$Cookie = $this->Cookie;
52+
53+
$this->cookiePrefix = $Cookie::getCookiePrefix();
5154
}
5255

5356
/**
54-
* Check if it is an instance of Algorithm.
57+
* Check if it is an instance of.
5558
*
5659
* @since 1.1.5
5760
*/
58-
public function testIsInstanceOfCookie()
61+
public function testIsInstanceOf()
5962
{
60-
$actual = $this->Cookie;
61-
$this->assertInstanceOf('\Josantonius\Cookie\Cookie', $actual);
63+
$this->assertInstanceOf('\Josantonius\Cookie\Cookie', $this->Cookie);
6264
}
6365

6466
/**
6567
* Set cookie.
6668
*
6769
* @runInSeparateProcess
68-
*
69-
* @since 1.1.3
7070
*/
7171
public function testSetCookie()
7272
{
73-
$this->assertTrue($this->Cookie->set('cookie_name', 'value', 365));
73+
$Cookie = $this->Cookie;
74+
75+
$this->assertTrue($Cookie::set('cookie_name', 'value', 365));
7476
}
7577

7678
/**
7779
* Get item from cookie.
7880
*
7981
* @runInSeparateProcess
80-
*
81-
* @since 1.1.3
8282
*/
8383
public function testGetCookie()
8484
{
85+
$Cookie = $this->Cookie;
86+
8587
$_COOKIE[$this->cookiePrefix . 'cookie_name'] = 'value';
8688

87-
$this->assertContains($this->Cookie->get('cookie_name'), 'value');
89+
$this->assertContains($Cookie::get('cookie_name'), 'value');
8890
}
8991

9092
/**
9193
* Return cookies array.
9294
*
9395
* @runInSeparateProcess
94-
*
95-
* @since 1.1.3
9696
*/
9797
public function testGetAllCookies()
9898
{
99+
$Cookie = $this->Cookie;
100+
99101
$_COOKIE[$this->cookiePrefix . 'cookie_name_one'] = 'value';
100102
$_COOKIE[$this->cookiePrefix . 'cookie_name_two'] = 'value';
101103

102104
$this->assertArrayHasKey(
103105
$this->cookiePrefix . 'cookie_name_two',
104-
$this->Cookie->get()
106+
$Cookie::get()
105107
);
106108
}
107109

108110
/**
109111
* Return cookies array non-existent.
110112
*
111113
* @runInSeparateProcess
112-
*
113-
* @since 1.1.3
114114
*/
115115
public function testGetAllCookiesNonExistents()
116116
{
117-
$this->assertFalse($this->Cookie->get());
117+
$Cookie = $this->Cookie;
118+
119+
$this->assertFalse($Cookie::get());
118120
}
119121

120122
/**
121123
* Extract item from cookie then delete cookie and return the item.
122124
*
123125
* @runInSeparateProcess
124-
*
125-
* @since 1.1.3
126126
*/
127127
public function testPullCookie()
128128
{
129+
$Cookie = $this->Cookie;
130+
129131
$_COOKIE[$this->cookiePrefix . 'cookie_name'] = 'value';
130132

131-
$this->assertContains($this->Cookie->pull('cookie_name'), 'value');
133+
$this->assertContains($Cookie::pull('cookie_name'), 'value');
132134
}
133135

134136
/**
135137
* Extract item from cookie non-existent.
136138
*
137139
* @runInSeparateProcess
138-
*
139-
* @since 1.1.3
140140
*/
141141
public function testPullCookieNonExistent()
142142
{
143-
$this->assertFalse($this->Cookie->pull('cookie_name'));
143+
$Cookie = $this->Cookie;
144+
145+
$this->assertFalse($Cookie::pull('cookie_name'));
144146
}
145147

146148
/**
147149
* Destroy one cookie.
148150
*
149151
* @runInSeparateProcess
150-
*
151-
* @since 1.1.3
152152
*/
153153
public function testDestroyOneCookie()
154154
{
155+
$Cookie = $this->Cookie;
156+
155157
$_COOKIE[$this->cookiePrefix . 'cookie_name'] = 'value';
156158

157-
$this->assertTrue($this->Cookie->destroy('cookie_name'));
159+
$this->assertTrue($Cookie::destroy('cookie_name'));
158160
}
159161

160162
/**
161163
* Destroy one cookie non-existent.
162164
*
163165
* @runInSeparateProcess
164-
*
165-
* @since 1.1.3
166166
*/
167167
public function testDestroyOneCookieNonExistent()
168168
{
169-
$this->assertFalse($this->Cookie->destroy('cookie_name'));
169+
$Cookie = $this->Cookie;
170+
171+
$this->assertFalse($Cookie::destroy('cookie_name'));
170172
}
171173

172174
/**
173175
* Destroy all cookies.
174176
*
175177
* @runInSeparateProcess
176-
*
177-
* @since 1.1.3
178178
*/
179179
public function testDestroyAllCookies()
180180
{
181+
$Cookie = $this->Cookie;
182+
181183
$_COOKIE[$this->cookiePrefix . 'cookie_name_one'] = 'value';
182184
$_COOKIE[$this->cookiePrefix . 'cookie_name_two'] = 'value';
183185

184-
$this->assertTrue($this->Cookie->destroy());
186+
$this->assertTrue($Cookie::destroy());
185187
}
186188

187189
/**
188190
* Destroy all cookies non-existents.
189191
*
190192
* @runInSeparateProcess
191-
*
192-
* @since 1.1.3
193193
*/
194194
public function testDestroyAllCookiesNonExistents()
195195
{
196-
$this->assertFalse($this->Cookie->destroy());
196+
$Cookie = $this->Cookie;
197+
198+
$this->assertFalse($Cookie::destroy());
197199
}
198200
}

0 commit comments

Comments
 (0)