Skip to content

Commit a884313

Browse files
committed
Merge branch '2.7' into 2.8
2 parents 43df701 + 0cd725e commit a884313

File tree

7 files changed

+76
-34
lines changed

7 files changed

+76
-34
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -734,9 +734,8 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder
734734
->in($dirs)
735735
;
736736

737-
$locales = array();
738737
foreach ($finder as $file) {
739-
list($domain, $locale, $format) = explode('.', $file->getBasename(), 3);
738+
list(, $locale) = explode('.', $file->getBasename(), 3);
740739
if (!isset($files[$locale])) {
741740
$files[$locale] = array();
742741
}

src/Symfony/Component/Form/DataTransformerInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function transform($value);
5858
*
5959
* This method must be able to deal with empty values. Usually this will
6060
* be an empty string, but depending on your implementation other empty
61-
* values are possible as well (such as empty strings). The reasoning behind
61+
* values are possible as well (such as NULL). The reasoning behind
6262
* this is that value transformers must be chainable. If the
6363
* reverseTransform() method of the first value transformer outputs an
6464
* empty string, the second value transformer must be able to process that

src/Symfony/Component/HttpKernel/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

src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php

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

114114
$context = new RequestContext();
115-
$requestMatcher->expects($this->any())
116-
->method('getContext')
117-
->will($this->returnValue($context));
118115

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

src/Symfony/Component/HttpKernel/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')
@@ -1228,3 +1225,17 @@ public function testEsiCacheRemoveValidationHeadersIfEmbeddedResponses()
12281225
$this->assertNull($this->response->getLastModified());
12291226
}
12301227
}
1228+
1229+
class TestKernel implements HttpKernelInterface
1230+
{
1231+
public $terminateCalled = false;
1232+
1233+
public function terminate(Request $request, Response $response)
1234+
{
1235+
$this->terminateCalled = true;
1236+
}
1237+
1238+
public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true)
1239+
{
1240+
}
1241+
}

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

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

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

@@ -730,22 +730,18 @@ public function testTerminateReturnsSilentlyIfKernelIsNotBooted()
730730
public function testTerminateDelegatesTerminationOnlyForTerminableInterface()
731731
{
732732
// does not implement TerminableInterface
733-
$httpKernelMock = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')
734-
->disableOriginalConstructor()
735-
->getMock();
736-
737-
$httpKernelMock
738-
->expects($this->never())
739-
->method('terminate');
733+
$httpKernel = new TestKernel();
740734

741735
$kernel = $this->getKernel(array('getHttpKernel'));
742736
$kernel->expects($this->once())
743737
->method('getHttpKernel')
744-
->will($this->returnValue($httpKernelMock));
738+
->willReturn($httpKernel);
745739

746740
$kernel->boot();
747741
$kernel->terminate(Request::create('/'), new Response());
748742

743+
$this->assertFalse($httpKernel->terminateCalled, 'terminate() is never called if the kernel class does not implement TerminableInterface');
744+
749745
// implements TerminableInterface
750746
$httpKernelMock = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernel')
751747
->disableOriginalConstructor()
@@ -847,3 +843,17 @@ protected function getKernelForTest(array $methods = array())
847843
return $kernel;
848844
}
849845
}
846+
847+
class TestKernel implements HttpKernelInterface
848+
{
849+
public $terminateCalled = false;
850+
851+
public function terminate()
852+
{
853+
$this->terminateCalled = true;
854+
}
855+
856+
public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true)
857+
{
858+
}
859+
}

src/Symfony/Component/Translation/Tests/Writer/TranslationWriterTest.php

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\Translation\Tests\Writer;
1313

14+
use Symfony\Component\Translation\Dumper\DumperInterface;
1415
use Symfony\Component\Translation\MessageCatalogue;
1516
use Symfony\Component\Translation\Writer\TranslationWriter;
1617

@@ -30,18 +31,35 @@ public function testWriteTranslations()
3031

3132
public function testDisableBackup()
3233
{
33-
$dumper = $this->getMock('Symfony\Component\Translation\Dumper\DumperInterface');
34-
$dumper
35-
->expects($this->never())
36-
->method('setBackup');
37-
$phpDumper = $this->getMock('Symfony\Component\Translation\Dumper\PhpFileDumper');
38-
$phpDumper
39-
->expects($this->once())
40-
->method('setBackup');
34+
$nonBackupDumper = new NonBackupDumper();
35+
$backupDumper = new BackupDumper();
4136

4237
$writer = new TranslationWriter();
43-
$writer->addDumper('test', $dumper);
44-
$writer->addDumper('php', $phpDumper);
38+
$writer->addDumper('non_backup', $nonBackupDumper);
39+
$writer->addDumper('backup', $backupDumper);
4540
$writer->disableBackup();
41+
42+
$this->assertFalse($backupDumper->backup, 'backup can be disabled if setBackup() method does exist');
43+
}
44+
}
45+
46+
class NonBackupDumper implements DumperInterface
47+
{
48+
public function dump(MessageCatalogue $messages, $options = array())
49+
{
50+
}
51+
}
52+
53+
class BackupDumper implements DumperInterface
54+
{
55+
public $backup = true;
56+
57+
public function dump(MessageCatalogue $messages, $options = array())
58+
{
59+
}
60+
61+
public function setBackup($backup)
62+
{
63+
$this->backup = $backup;
4664
}
4765
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy