<
8000
div class="d-none">
File tree Expand file tree Collapse file tree 5 files changed +25
-10
lines changed
src/Symfony/Component/HttpFoundation Expand file tree Collapse file tree 5 files changed +25
-10
lines changed Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ install:
86
86
- if [[ ! $skip && $deps ]]; then export SYMFONY_DEPRECATIONS_HELPER=weak; fi
87
87
- if [[ ! $skip && $deps ]]; then mv composer.json.phpunit composer.json; fi
88
88
- if [[ ! $skip ]]; then composer update; fi
89
- - if [[ ! $skip ]]; then COMPOSER_ROOT_VERSION= ./phpunit install; fi
89
+ - if [[ ! $skip ]]; then ./phpunit install; fi
90
90
- if [[ ! $skip && ! $PHP = hhvm* ]]; then php -i; else hhvm --php -r 'print_r($_SERVER);print_r(ini_get_all());'; fi
91
91
92
92
script :
@@ -95,7 +95,7 @@ script:
95
95
- if [[ ! $deps && ! $PHP = hhvm* ]]; then echo -e "\\nRunning tests requiring tty"; $PHPUNIT --group tty; fi
96
96
- if [[ ! $deps && $PHP = hhvm* ]]; then $PHPUNIT --exclude-group benchmark,intl-data; fi
97
97
- if [[ ! $deps && $PHP = ${MIN_PHP%.*} ]]; then echo -e "1\\n0" | xargs -I{} sh -c 'echo "\\nPHP --enable-sigchild enhanced={}" && ENHANCE_SIGCHLD={} php-$MIN_PHP/sapi/cli/php .phpunit/phpunit-4.8/phpunit --colors=always src/Symfony/Component/Process/'; fi
98
- - if [[ $deps = high ]]; then echo "$COMPONENTS" | parallel --gnu -j10% 'cd {}; composer update --no-progress --ansi; $PHPUNIT --exclude-group tty,benchmark,intl-data'$LEGACY; fi
99
- - if [[ $deps = low ]]; then echo "$COMPONENTS" | parallel --gnu -j10% 'cd {}; composer update --no-progress --ansi --prefer-lowest --prefer-stable; $PHPUNIT --exclude-group tty,benchmark,intl-data'; fi
98
+ - if [[ $deps = high ]]; then echo "$COMPONENTS" | parallel --gnu -j10% 'cd {}; composer update --no-progress --ansi; $PHPUNIT --exclude-group tty,benchmark,intl-data'$LEGACY' && echo -e "\\e[33mOK\\e[0m {}" || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1))' ; fi
99
+ - if [[ $deps = low ]]; then echo "$COMPONENTS" | parallel --gnu -j10% 'cd {}; composer update --no-progress --ansi --prefer-lowest --prefer-stable; $PHPUNIT --exclude-group tty,benchmark,intl-data && echo -e "\\e[33mOK\\e[0m {}" || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1)) '; fi
100
100
# Test the PhpUnit bridge using the original phpunit script
101
101
- if [[ $deps = low ]]; then (cd src/Symfony/Bridge/PhpUnit && phpenv global 5.3 && php --version && composer update && phpunit); fi
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ clone_depth: 1
3
3
clone_folder : c:\projects\symfony
4
4
5
5
cache :
6
- - c:\projects\symfony\ composer.phar
6
+ - composer.phar
7
7
- .phpunit -> phpunit
8
8
9
9
init :
@@ -46,13 +46,12 @@ install:
46
46
- echo curl.cainfo=c:\php\cacert.pem >> php.ini-max
47
47
- copy /Y php.ini-max php.ini
48
48
- cd c:\projects\symfony
49
- - IF NOT EXIST composer.phar (appveyor DownloadFile https://getcomposer.org/download/1.2.1 /composer.phar)
49
+ - IF NOT EXIST composer.phar (appveyor DownloadFile https://getcomposer.org/download/1.3.0 /composer.phar)
50
50
- php composer.phar self-update
51
51
- copy /Y .composer\* %APPDATA%\Composer\
52
52
- php .github/build-packages.php "HEAD^" src\Symfony\Bridge\PhpUnit
53
53
- IF %APPVEYOR_REPO_BRANCH%==master (SET COMPOSER_ROOT_VERSION=dev-master) ELSE (SET COMPOSER_ROOT_VERSION=%APPVEYOR_REPO_BRANCH%.x-dev)
54
54
- php composer.phar update --no-progress --ansi
55
- - SET COMPOSER_ROOT_VERSION=
56
55
- php phpunit install
57
56
58
57
test_script :
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env php
2
2
<?php
3
3
4
+ // Cache-Id: https://github.com/symfony/phpunit-bridge/commit/89cd0aab376105fb34e773e3dff641f68e3f9645
5
+
4
6
if (!file_exists (__DIR__ .'/vendor/symfony/phpunit-bridge/bin/simple-phpunit ' )) {
5
7
echo "Unable to find the `simple-phpunit` script in `vendor/symfony/phpunit-bridge/bin/`. \nPlease run `composer update` before running this command. \n" ;
6
8
exit (1 );
Original file line number Diff line number Diff line change @@ -112,15 +112,15 @@ public function __construct($name, $value = null, $expire = 0, $path = '/', $dom
112
112
} elseif (!is_numeric ($ expire )) {
113
113
$ expire = strtotime ($ expire );
114
114
115
- if (false === $ expire || - 1 === $ expire ) {
115
+ if (false === $ expire ) {
116
116
throw new \InvalidArgumentException ('The cookie expiration time is not valid. ' );
117
117
}
118
118
}
119
119
120
120
$ this ->name = $ name ;
121
121
$ this ->value = $ value ;
122
122
$ this ->domain = $ domain ;
123
- $ this ->expire = $ expire ;
123
+ $ this ->expire = 0 < $ expire ? ( int ) $ expire : 0 ;
124
124
$ this ->path = empty ($ path ) ? '/ ' : $ path ;
125
125
$ this ->secure = (bool ) $ secure ;
126
126
$ this ->httpOnly = (bool ) $ httpOnly ;
@@ -147,7 +147,7 @@ public function __toString()
147
147
} else {
148
148
$ str .= $ this ->isRaw () ? $ this ->getValue () : urlencode ($ this ->getValue ());
149
149
150
- if ($ this ->getExpiresTime () !== 0 ) {
150
+ if (0 !== $ this ->getExpiresTime ()) {
151
151
$ str .= '; expires= ' .gmdate ('D, d-M-Y H:i:s T ' , $ this ->getExpiresTime ()).'; max-age= ' .$ this ->getMaxAge ();
152
152
}
153
153
}
Original file line number Diff line number Diff line change @@ -52,7 +52,14 @@ public function testInstantiationThrowsExceptionIfCookieNameContainsInvalidChara
52
52
*/
53
53
public function testInvalidExpiration ()
54
54
{
55
- $ cookie = new Cookie ('MyCookie ' , 'foo ' , 'bar ' );
55
+ new Cookie ('MyCookie ' , 'foo ' , 'bar ' );
56
+ }
57
+
58
+ public function testNegativeExpirationIsNotPossible ()
59
+ {
60
+ $ cookie = new Cookie ('foo ' , 'bar ' , -100 );
61
+
62
+ $ this ->assertSame (0 , $ cookie ->getExpiresTime ());
56
63
}
57
64
58
65
public function testGetValue ()
@@ -81,6 +88,13 @@ public function testGetExpiresTime()
81
88
$ this ->assertEquals ($ expire , $ cookie ->getExpiresTime (), '->getExpiresTime() returns the expire date ' );
82
89
}
83
90
91
+ public function testGetExpiresTimeIsCastToInt ()
92
+ {
93
+ $ cookie = new Cookie ('foo ' , 'bar ' , 3600.9 );
94
+
95
+ $ this ->assertSame (3600 , $ cookie ->getExpiresTime (), '->getExpiresTime() returns the expire date as an integer ' );
96
+ }
97
+
84
98
public function testConstructorWithDateTime ()
85
99
{
86
100
$ expire = new \DateTime ();
0 commit comments