diff --git a/.travis.yml b/.travis.yml index beb02aa455..841da8314f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -66,8 +66,9 @@ before_script: script: # PHP7 + precise のテストは実行されない - if [[ $PHP_SAPI = 'phpdbg' ]] && [[ $CODENAME = 'trusty' ]]; then phpdbg -qrr ./vendor/bin/phpunit --coverage-clover=coverage.clover ; fi - - if [[ $PHP_SAPI != 'phpdbg' ]]; then ./vendor/bin/phpunit ; fi - + # - if [[ $PHP_SAPI != 'phpdbg' ]]; then ./vendor/bin/phpunit ; fi + - 'sed -i -e "s|force_ssl:\(.*\)|force_ssl: 1|" app/config/eccube/config.yml' # force_ssl を有効にしてテスト + - if [[ $PHP_SAPI != 'phpdbg' ]]; then ./vendor/bin/phpunit tests/Eccube/Tests/Web/SameSiteCookieTest.php ; fi after_script: - if [[ $PHP_SAPI = 'phpdbg' ]]; then wget https://scrutinizer-ci.com/ocular.phar ; fi - if [[ $PHP_SAPI = 'phpdbg' ]]; then php ocular.phar code-coverage:upload --format=php-clover coverage.clover ; fi diff --git a/tests/Eccube/Tests/Web/SameSiteCookieTest.php b/tests/Eccube/Tests/Web/SameSiteCookieTest.php new file mode 100644 index 0000000000..df36e7c5d5 --- /dev/null +++ b/tests/Eccube/Tests/Web/SameSiteCookieTest.php @@ -0,0 +1,47 @@ +app['config']['force_ssl']) { + $this->markTestSkipped('force_ssl required'); + } + $this->client->request('GET', $this->app['url_generator']->generate('homepage')); + $this->assertTrue($this->client->getResponse()->isSuccessful()); + $cookieParams = session_get_cookie_params(); + if ($shouldSendSameSiteNone) { + if (PHP_VERSION_ID >= 70300) { + $this->assertEquals('/', $cookieParams['path']); + $this->assertEquals('none', $cookieParams['samesite']); + } else { + $this->assertEquals('/; SameSite=none', $cookieParams['path']); + } + } else { + $this->assertEquals('/', $cookieParams['path']); + } + } +}