Skip to content

Commit 579f828

Browse files
committed
Merge branch '2.8' into 3.0
2 parents 391723a + 2c45576 commit 579f828

File tree

4 files changed

+46
-21
lines changed

4 files changed

+46
-21
lines changed

Tests/DependencyInjection/MergeExtensionConfigurationPassTest.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,14 @@ public function testAutoloadMainExtension()
1919
{
2020
$container = $this->getMock(
2121
'Symfony\\Component\\DependencyInjection\\ContainerBuilder',
22-
array('getExtensionConfig', 'loadFromExtension', 'getParameterBag')
22+
array(
23+
'getExtensionConfig',
24+
'loadFromExtension',
25+
'getParameterBag',
26+
'getDefinitions',
27+
'getAliases',
28+
'getExtensions',
29+
)
2330
);
2431
$params = $this->getMock('Symfony\\Component\\DependencyInjection\\ParameterBag\\ParameterBag');
2532

Tests/EventListener/RouterListenerTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,6 @@ public function testSubRequestWithDifferentMethod()
111111
->will($this->returnValue(array()));
112112

113113
$context = new RequestContext();
114-
$requestMatcher->expects($this->any())
115-
->method('getContext')
116-
->will($this->returnValue($context));
117114

118115
$listener = new RouterListener($requestMatcher, $this->requestStack, new RequestContext());
119116
$listener->onKernelRequest($event);

Tests/HttpCache/HttpCacheTest.php

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Component\HttpKernel\HttpCache\HttpCache;
1515
use Symfony\Component\HttpFoundation\Request;
1616
use Symfony\Component\HttpFoundation\Response;
17+
use Symfony\Component\HttpKernel\HttpKernelInterface;
1718

1819
/**
1920
* @group time-sensitive
@@ -27,15 +28,11 @@ public function testTerminateDelegatesTerminationOnlyForTerminableInterface()
2728
->getMock();
2829

2930
// does not implement TerminableInterface
30-
$kernelMock = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\HttpKernelInterface')
31-
->disableOriginalConstructor()
32-
->getMock();
33-
34-
$kernelMock->expects($this->never())
35-
->method('terminate');
31+
$kernel = new TestKernel();
32+
$httpCache = new HttpCache($kernel, $storeMock);
33+
$httpCache->terminate(Request::create('/'), new Response());
3634

37-
$kernel = new HttpCache($kernelMock, $storeMock);
38-
$kernel->terminate(Request::create('/'), new Response());
35+
$this->assertFalse($kernel->terminateCalled, 'terminate() is never called if the kernel class does not implement TerminableInterface');
3936

4037
// implements TerminableInterface
4138
$kernelMock = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\Kernel')
@@ -1225,3 +1222,17 @@ public function testEsiCacheRemoveValidationHeadersIfEmbeddedResponses()
12251222
$this->assertNull($this->response->getLastModified());
12261223
}
12271224
}
1225+
1226+
class TestKernel implements HttpKernelInterface
1227+
{
1228+
public $terminateCalled = false;
1229+
1230+
public function terminate(Request $request, Response $response)
1231+
{
1232+
$this->terminateCalled = true;
1233+
}
1234+
1235+
public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true)
1236+
{
1237+
}
1238+
}

Tests/KernelTest.php

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function testClassCacheIsLoaded()
9898

9999
public function testClassCacheIsNotLoadedByDefault()
100100
{
101-
$kernel = $this->getKernel(array('initializeBundles', 'initializeContainer'));
101+
$kernel = $this->getKernel(array('initializeBundles', 'initializeContainer', 'doLoadClassCache'));
102102
$kernel->expects($this->never())
103103
->method('doLoadClassCache');
104104

@@ -687,22 +687,18 @@ public function testTerminateReturnsSilentlyIfKernelIsNotBooted()
687687
public function testTerminateDelegatesTerminationOnlyForTerminableInterface()
688688
{
689689
// does not implement TerminableInterface
690-
$httpKernelMock = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')
691-
->disableOriginalConstructor()
692-
->getMock();
693-
694-
$httpKernelMock
695-
->expects($this->never())
696-
->method('terminate');
690+
$httpKernel = new TestKernel();
697691

698692
$kernel = $this->getKernel(array('getHttpKernel'));
699693
$kernel->expects($this->once())
700694
->method('getHttpKernel')
701-
->will($this->returnValue($httpKernelMock));
695+
->willReturn($httpKernel);
702696

703697
$kernel->boot();
704698
$kernel->terminate(Request::create('/'), new Response());
705699

700+
$this->assertFalse($httpKernel->terminateCalled, 'terminate() is never called if the kernel class does not implement TerminableInterface');
701+
706702
// implements TerminableInterface
707703
$httpKernelMock = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernel')
708704
->disableOriginalConstructor()
@@ -804,3 +800,17 @@ protected function getKernelForTest(array $methods = array())
804800
return $kernel;
805801
}
806802
}
803+
804+
class TestKernel implements HttpKernelInterface
805+
{
806+
public $terminateCalled = false;
807+
808+
public function terminate()
809+
{
810+
$this->terminateCalled = true;
811+
}
812+
813+
public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true)
814+
{
815+
}
816+
}

0 commit comments

Comments
 (0)