8000 Merge branch '2.8' · symfony/symfony@bceb2d9 · GitHub
[go: up one dir, main page]

Skip to content

Commit bceb2d9

Browse files
Merge branch '2.8'
* 2.8: asset test coverage [HttpKernel] PostResponseEvent should extend the KernelEvent [travis] session.gc_probability=0 to fix transient tests on hhvm Write the log message on a single line againn [DI] Deprecate ContainerAware in favor of ContainerAwareTrait [VarDumper] Deprecate VarDumperTestCase in favor of the trait Check whether $this->logger is not null on GuardAuthenticationListener [Console] Add progress indicator helper Conflicts: .travis.yml
2 parents 3f0bb90 + 9e39329 commit bceb2d9

File tree

10 files changed

+154
-41
lines changed

10 files changed

+154
-41
lines changed

.travis.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,18 @@ env:
3131

3232
before_install:
3333
- if [[ "$deps" = "no" ]] && [[ "$TRAVIS_PHP_VERSION" = 5.6 ]] && [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then export deps=skip; fi;
34+
- if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then INI_FILE=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; else INI_FILE=/etc/hhvm/php.ini; fi;
35+
- echo "memory_limit = -1" >> $INI_FILE
36+
- echo "session.gc_probability = 0" >> $INI_FILE
3437
- if [ "$deps" != "skip" ]; then composer self-update; fi;
35-
- if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then echo "memory_limit = -1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; fi;
3638
- if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then phpenv config-rm xdebug.ini; fi;
37-
- if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then echo "extension = mongo.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;
38-
- if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;
39-
- if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then (echo yes | pecl install -f apcu-4.0.7 && echo "apc.enable_cli = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini) || echo "Let's continue without apcu extension"; fi;
39+
- if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then echo "extension = mongo.so" >> $INI_FILE; fi;
40+
- if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then echo "extension = memcache.so" >> $INI_FILE; fi;
41+
- if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then (echo yes | pecl install -f apcu-4.0.7 && echo "apc.enable_cli = 1" >> $INI_FILE) || echo "Let's continue without apcu extension"; fi;
4042
- if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then pecl install -f memcached-2.1.0 || echo "Let's continue without memcached extension"; fi;
41-
- if [[ "$TRAVIS_PHP_VERSION" = 5.* ]] && [ "$deps" = "no" ]; then (cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo "extension = $(pwd)/modules/symfony_debug.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini); fi;
42-
- if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then echo "extension = ldap.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;
43-
- if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then php -i; fi;
43+
- if [[ "$TRAVIS_PHP_VERSION" = 5.* ]] && [ "$deps" = "no" ]; then (cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && e 8000 cho "extension = $(pwd)/modules/symfony_debug.so" >> $INI_FILE); fi;
44+
- if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then echo "extension = ldap.so" >> $INI_FILE; fi;
45+
- if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then php -i; else hhvm --php -r 'print_r($_SERVER);print_r(ini_get_all());'; fi;
4446
- if [ "$deps" != "skip" ]; then ./phpunit install; fi;
4547
- export PHPUNIT="$(readlink -f ./phpunit)"
4648

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Asset\Tests\Context;
13+
14+
use Symfony\Component\Asset\Context\NullContext;
15+
16+
class NullContextTest extends \PHPUnit_Framework_TestCase
17+
{
18+
public function testGetBasePath()
19+
{
20+
$nullContext = new NullContext();
21+
22+
$this->assertEmpty($nullContext->getBasePath());
23+
}
24+
25+
public function testIsSecure()
26+
{
27+
$nullContext = new NullContext();
28+
29+
$this->assertFalse($nullContext->isSecure());
30+
}
31+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Asset\Tests\Context;
13+
14+
use Symfony\Component\Asset\Context\RequestStackContext;
15+
16+
class RequestStackContextTest extends \PHPUnit_Framework_TestCase
17+
{
18+
public function testGetBasePathEmpty()
19+
{
20+
$requestStack = $this->getMock('Symfony\Component\HttpFoundation\RequestStack');
21+
$requestStackContext = new RequestStackContext($requestStack);
22+
23+
$this->assertEmpty($requestStackContext->getBasePath());
24+
}
25+
26+
public function testGetBasePathSet()
27+
{
28+
$testBasePath = 'test-path';
29+
30+
$request = $this->getMock('Symfony\Component\HttpFoundation\Request');
31+
$request->method('getBasePath')
32+
->willReturn($testBasePath);
33+
$requestStack = $this->getMock('Symfony\Component\HttpFoundation\RequestStack');
34+
$requestStack->method('getMasterRequest')
35+
->willReturn($request);
36+
37+
$requestStackContext = new RequestStackContext($requestStack);
38+
39+
$this->assertEquals($testBasePath, $requestStackContext->getBasePath());
40+
}
41+
42+
public function testIsSecureFalse()
43+
{
44+
$requestStack = $this->getMock('Symfony\Component\HttpFoundation\RequestStack');
45+
$requestStackContext = new RequestStackContext($requestStack);
46+
47+
$this->assertFalse($requestStackContext->isSecure());
48+
}
49+
50+
public function testIsSecureTrue()
51+
{
52+
$request = $this->getMock('Symfony\Component\HttpFoundation\Request');
53+
$request->method('isSecure')
54+
->willReturn(true);
55+
$requestStack = $this->getMock('Symfony\Component\HttpFoundation\RequestStack');
56+
$requestStack->method('getMasterRequest')
57+
->willReturn($request);
58+
59+
$requestStackContext = new RequestStackContext($requestStack);
60+
61+
$this->assertTrue($requestStackContext->isSecure());
62+
}
63+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Asset\Tests\VersionStrategy;
13+
14+
use Symfony\Component\Asset\VersionStrategy\EmptyVersionStrategy;
15+
16+
class EmptyVersionStrategyTest extends \PHPUnit_Framework_TestCase
17+
{
18+
public function testGetVersion()
19+
{
20+
$emptyVersionStrategy = new EmptyVersionStrategy();
21+
$path = 'test-path';
22+
23+
$this->assertEmpty($emptyVersionStrategy->getVersion($path));
24+
}
25+
26+
public function testApplyVersion()
27+
{
28+
$emptyVersionStrategy = new EmptyVersionStrategy();
29+
$path = 'test-path';
30+
31+
$this->assertEquals($path, $emptyVersionStrategy->applyVersion($path));
32+
}
33+
}

src/Symfony/Component/DependencyInjection/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ CHANGELOG
99
2.8.0
1010
-----
1111

12+
* deprecated the abstract ContainerAware class in favor of ContainerAwareTrait
1213
* deprecated IntrospectableContainerInterface, to be merged with ContainerInterface in 3.0
1314
* allowed specifying a directory to recursively load all configuration files it contains
1415
* deprecated the concept of scopes

src/Symfony/Component/DependencyInjection/ContainerAware.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
* A simple implementation of ContainerAwareInterface.
1616
*
1717
* @author Fabien Potencier <fabien@symfony.com>
18+
*
19+
* @deprecated since version 2.8, to be removed in 3.0. Use the ContainerAwareTrait instead.
1820
*/
1921
abstract class ContainerAware implements ContainerAwareInterface
2022
{

src/Symfony/Component/HttpKernel/Event/PostResponseEvent.php

Lines changed: 6 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -12,53 +12,26 @@
1212
namespace Symfony\Component\HttpKernel\Event;
1313

1414
use Symfony\Component\HttpKernel\HttpKernelInterface;
15-
use Symfony\Component\EventDispatcher\Event;
1615
use Symfony\Component\HttpFoundation\Request;
1716
use Symfony\Component\HttpFoundation\Response;
1817

1918
/**
2019
* Allows to execute logic after a response was sent.
2120
*
21+
* Since it's only triggered on master requests, the `getRequestType()` method
22+
* will always return the value of `HttpKernelInterface::MASTER_REQUEST`.
23+
*
2224
* @author Jordi Boggiano <j.boggiano@seld.be>
2325
*/
24-
class PostResponseEvent extends Event
26+
class PostResponseEvent extends KernelEvent
2527
{
26-
/**
27-
* The kernel in which this event was thrown.
28-
*
29-
* @var HttpKernelInterface
30-
*/
31-
private $kernel;
32-
33-
private $request;
34-
3528
private $response;
3629

3730
public function __construct(HttpKernelInterface $kernel, Request $request, Response $response)
3831
{
39-
$this->kernel = $kernel;
40-
$this->request = $request;
41-
$this->response = $response;
42-
}
32+
parent::__construct($kernel, $request, HttpKernelInterface::MASTER_REQUEST);
4333

44-
/**
45-
* Returns the kernel in which this event was thrown.
46-
*
47-
* @return HttpKernelInterface
48-
*/
49-
public function getKernel()
50-
{
51-
return $this->kernel;
52-
}
53-
54-
/**
55-
* Returns the request for which this event was thrown.
56-
*
57-
* @return Request
58-
*/
59-
public function getRequest()
60-
{
61-
return $this->request;
34+
$this->response = $response;
6235
}
6336

6437
/**

src/Symfony/Component/HttpKernel/Tests/Fragment/FragmentHandlerTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Component\HttpKernel\Fragment\FragmentHandler;
1515
use Symfony\Component\HttpFoundation\Request;
1616
use Symfony\Component\HttpFoundation\Response;
17+
use Symfony\Bridge\PhpUnit\ClockMock;
1718

1819
/**
1920
* @group time-sensitive
@@ -24,6 +25,9 @@ class FragmentHandlerTest extends \PHPUnit_Framework_TestCase
2425

2526
protected function setUp()
2627
{
28+
if (class_exists('Symfony\Bridge\PhpUnit\ClockMock')) {
29+
ClockMock::register('Symfony\Component\HttpFoundation\Request');
30+
}
2731
$this->requestStack = $this->getMockBuilder('Symfony\\Component\\HttpFoundation\\RequestStack')
2832
->disableOriginalConstructor()
2933
->getMock()

src/Symfony/Component/Security/Guard/Firewall/GuardAuthenticationListener.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ public function handle(GetResponseEvent $event)
7777
$this->executeGuardAuthenticator($uniqueGuardKey, $guardAuthenticator, $event);
7878

7979
if ($event->hasResponse()) {
80-
$this->logger->debug(sprintf('The "%s" authenticator set the response. Any later authenticator will not be called', get_class($guardAuthenticator)));
80+
if (null !== $this->logger) {
81+
$this->logger->debug(sprintf('The "%s" authenticator set the response. Any later authenticator will not be called', get_class($guardAuthenticator)));
82+
}
8183

8284
break;
8385
}

src/Symfony/Component/VarDumper/Test/VarDumperTestCase.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
/**
1818
* @author Nicolas Grekas <p@tchwork.com>
19+
*
20+
* @deprecated since version 2.8, to be removed in 3.0. Use the VarDumperTestTrait instead.
1921
*/
2022
abstract class VarDumperTestCase extends \PHPUnit_Framework_TestCase
2123
{

0 commit comments

Comments
 (0)
0