8000 merged 2.0 · symfony/symfony@c29edb5 · GitHub
[go: up one dir, main page]

Skip to content

Commit c29edb5

Browse files
committed
merged 2.0
2 parents 71732b1 + 9a355e9 commit c29edb5

File tree

5 files changed

+121
-15
lines changed

5 files changed

+121
-15
lines changed

src/Symfony/Bridge/Monolog/Handler/DebugHandler.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ public function getLogs()
4747
public function countErrors()
4848
{
4949
$cnt = 0;
50-
foreach (array(Logger::ERROR, Logger::CRITICAL, Logger::ALERT) as $level) {
50+
$levels = array(Logger::ERROR, Logger::CRITICAL, Logger::ALERT);
51+
if (defined('Monolog\Logger::EMERGENCY')) {
52+
$levels[] = Logger::EMERGENCY;
53+
}
54+
foreach ($levels as $level) {
5155
if (isset($this->recordsByLevel[$level])) {
5256
$cnt += count($this->recordsByLevel[$level]);
5357
}

src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,15 @@ public function testGetArguments()
134134
$request->attributes->set('foobar', 'foobar');
135135
$controller = array(new self(), 'controllerMethod3');
136136

137-
try {
138-
$resolver->getArguments($request, $controller);
139-
$this->fail('->getArguments() throws a \RuntimeException exception if it cannot determine the argument value');
140-
} catch (\Exception $e) {
141-
$this->assertInstanceOf('\RuntimeException', $e, '->getArguments() throws a \RuntimeException exception if it cannot determine the argument value');
137+
if (version_compare(PHP_VERSION, '5.3.16', '==')) {
138+
$this->markTestSkipped('PHP 5.3.16 has a major bug in the Reflection sub-system');
139+
} else {
140+
try {
141+
$resolver->getArguments($request, $controller);
142+
$this->fail('->getArguments() throws a \RuntimeException exception if it cannot determine the argument value');
143+
} catch (\Exception $e) {
144+
$this->assertInstanceOf('\RuntimeException', $e, '->getArguments() throws a \RuntimeException exception if it cannot determine the argument value');
145+
}
142146
}
143147

144148
$request = Request::create('/');

src/Symfony/Component/HttpKernel/Tests/KernelTest.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -293,15 +293,7 @@ public function testGetRootDir()
293293
{
294294
$kernel = new KernelForTest('test', true);
295295

296-
$rootDir = __DIR__.DIRECTORY_SEPARATOR.'Fixtures';
297-
298-
// getRootDir() returns path with slashes
299-
// without conversion test fails on Windows
300-
if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
301-
$rootDir = strtr($rootDir, '\\', '/');
302-
}
303-
304-
$this->assertEquals($rootDir, $kernel->getRootDir());
296+
$this->assertEquals(__DIR__.DIRECTORY_SEPARATOR.'Fixtures', realpath($kernel->getRootDir()));
305297
}
306298

307299
public function testGetName()
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
3+
use Symfony\Component\DependencyInjection\ContainerInterface;
4+
use Symfony\Component\DependencyInjection\Container;
5+
use Symfony\Component\DependencyInjection\Exception\InactiveScopeException;
6+
use Symfony\Component\DependencyInjection\Reference;
7+
use Symfony\Component\DependencyInjection\Parameter;
8+
use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
9+
10+
/**
11+
* ProjectServiceContainer
12+
*
13+
* This class has been auto-generated
14+
* by the Symfony Dependency Injection Component.
15+
*/
16+
class ProjectServiceContainer extends Container
17+
{
18+
/**
19+
* Constructor.
20+
*/
21+
public function __construct()
22+
{
23+
$this->services =
24+
$this->scopedServices =
25+
$this->scopeStacks = array();
26+
27+
$this->set('service_container', $this);
28+
29+
$this->scopes = array();
30+
$this->scopeChildren = array();
31+
}
32+
33+
/**
34+
* Gets the 'foo' service.
35+
*
36+
* This service is shared.
37+
* This method always returns the same instance of the service.
38+
*
39+
* @return stdClass A stdClass instance.
40+
*/
41+
protected function getFooService()
42+
{
43+
return $this->services['foo'] = new \stdClass();
44+
}
45+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony framework.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* This source file is subject to the MIT license that is bundled
9+
* with this source code in the file LICENSE.
10+
*/
11+
12+
namespace Symfony\Tests\Component\Security\Http\Firewall;
13+
14+
use Symfony\Component\HttpFoundation\Request;
15+
use Symfony\Component\Security\Http\Firewall\ContextListener;
16+
17+
class ContextListenerTest extends \PHPUnit_Framework_TestCase
18+
{
19+
/**
20+
* @dataProvider provideInvalidToken
21+
*/
22+
public function testInvalidTokenInSession($token)
23+
{
24+
$context = $this->getMock('Symfony\Component\Security\Core\SecurityContextInterface');
25+
$event = $this->getMockBuilder('Symfony\Component\HttpKernel\Event\GetResponseEvent')
26+
->disableOriginalConstructor()
27+
->getMock();
28+
$request = $this->getMock('Symfony\Component\HttpFoundation\Request');
29+
$session = $this->getMockBuilder('Symfony\Component\HttpFoundation\Session')
30+
->disableOriginalConstructor()
31+
->getMock();
32+
33+
$event->expects($this->any())
34+
->method('getRequest')
35+
->will($this->returnValue($request));
36+
$request->expects($this->any())
37+
->method('hasPreviousSession')
38+
->will($this->returnValue(true));
39+
$request->expects($this->any())
40+
->method('getSession')
41+
->will($this->returnValue($session));
42+
$session->expects($this->any())
43+
->method('get')
44+
->with('_security_key123')
45+
->will($this->returnValue(serialize($token)));
46+
$context->expects($this->once())
47+
->method('setToken')
48+
->with(null);
49+
50+
$listener = new ContextListener($context, array(), 'key123');
51+
$listener->handle($event);
52+
}
53+
54+
public function provideInvalidToken()
55+
{
56+
return array(
57+
array(new \__PHP_Incomplete_Class()),
58+
array(null),
59+
);
60+
}
61+
}

0 commit comments

Comments
 (0)
0