Skip to content

Commit 089e5fb

Browse files
committed
Specification for optional cookie validation
1 parent f28c46e commit 089e5fb

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

spec/CookieSpec.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,38 @@ function it_matches_other_cookies()
239239
$this->match($notMatches)->shouldReturn(false);
240240
}
241241

242+
function it_validates_itself()
243+
{
244+
$this->isValid()->shouldReturn(true);
245+
}
246+
247+
/**
248+
* @dataProvider invalidCharacterExamples
249+
*/
250+
function it_can_be_constructed_without_name_validation($name, $invalid)
251+
{
252+
$this->beConstructedThrough('createWithoutValidation', [$name]);
253+
254+
$this->isValid()->shouldReturn(!$invalid);
255+
}
256+
257+
/**
258+
* @dataProvider invalidCharacterExamples
259+
*/
260+
function it_can_be_constructed_without_value_validation($value, $invalid)
261+
{
262+
$this->beConstructedThrough('createWithoutValidation', ['name', $value]);
263+
264+
$this->isValid()->shouldReturn(!$invalid);
265+
}
266+
267+
function it_can_be_constructed_without_max_age_validation()
268+
{
269+
$this->beConstructedThrough('createWithoutValidation', ['name', 'value', '-1']);
270+
271+
$this->isValid()->shouldReturn(false);
272+
}
273+
242274
/**
243275
* Provides examples for invalid characers in names and values.
244276
*

0 commit comments

Comments
 (0)