Skip to content

Commit 6376ea2

Browse files
minor #18321 [2.8] fix mocks (xabbuh)
This PR was squashed before being merged into the 2.8 branch (closes #18321). Discussion ---------- [2.8] fix mocks | Q | A | ------------- | --- | Branch? | 2.8 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Commits ------- 7dff706 [2.8] fix mocks
2 parents a884313 + 7dff706 commit 6376ea2

File tree

5 files changed

+41
-10
lines changed

5 files changed

+41
-10
lines changed

phpunit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*/
1212

1313
// Please update when phpunit needs to be reinstalled with fresh deps:
14-
// Cache-Id-Version: 2016-03-23 14:50 UTC
14+
// Cache-Id-Version: 2016-03-25 09:45 UTC
1515

1616
use Symfony\Component\Process\ProcessUtils;
1717

src/Symfony/Bundle/TwigBundle/Tests/Extension/LegacyAssetsExtensionTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@
1919
*/
2020
class LegacyAssetsExtensionTest extends TestCase
2121
{
22+
protected function setUp()
23+
{
24+
if (!class_exists('Symfony\Component\Templating\Helper\CoreAssetsHelper')) {
25+
$this->markTestSkipped('The CoreAssetsHelper class does only exist with symfony/templating < 3.0 installed.');
26+
}
27+
}
28+
2229
/**
2330
* @dataProvider provideGetAssetUrlArguments
2431
*/

src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use Symfony\Component\Validator\Constraints\NotNull;
2222
use Symfony\Component\Validator\Constraints\NotBlank;
2323
use Symfony\Component\Validator\Constraints\Valid;
24+
use Symfony\Component\Validator\ExecutionContextInterface;
2425
use Symfony\Component\Validator\Tests\Constraints\AbstractConstraintValidatorTest;
2526
use Symfony\Component\Validator\Validation;
2627

@@ -629,8 +630,11 @@ public function testNoViolationIfAllowExtraData()
629630

630631
$context->expects($this->never())
631632
->method('addViolation');
632-
$context->expects($this->never())
633-
->method('addViolationAt');
633+
634+
if ($context instanceof ExecutionContextInterface) {
635+
$context->expects($this->never())
636+
->method('addViolationAt');
637+
}
634638

635639
$this->validator->initialize($context);
636640
$this->validator->validate($form, new Form());

src/Symfony/Component/Form/Tests/Extension/Validator/ValidatorExtensionTest.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\Form\Tests\Extension\Validator;
1313

1414
use Symfony\Component\Form\Extension\Validator\ValidatorExtension;
15+
use Symfony\Component\Validator\ValidatorInterface;
1516

1617
class ValidatorExtensionTest extends \PHPUnit_Framework_TestCase
1718
{
@@ -38,9 +39,11 @@ public function test2Dot5ValidationApi()
3839
->method('addPropertyConstraint')
3940
->with('children', $this->isInstanceOf('Symfony\Component\Validator\Constraints\Valid'));
4041

41-
$validator
42-
->expects($this->never())
43-
->method('getMetadataFactory');
42+
if ($validator instanceof ValidatorInterface) {
43+
$validator
44+
->expects($this->never())
45+
->method('getMetadataFactory');
46+
}
4447

4548
$extension = new ValidatorExtension($validator);
4649
$guesser = $extension->loadTypeGuesser();

src/Symfony/Component/Templating/Tests/DelegatingEngineTest.php

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,7 @@ public function testStreamDelegatesToSupportedEngine()
6666
*/
6767
public function testStreamRequiresStreamingEngine()
6868
{
69-
$engine = $this->getEngineMock('template.php', true);
70-
$engine->expects($this->never())->method('stream');
71-
72-
$delegatingEngine = new DelegatingEngine(array($engine));
69+
$delegatingEngine = new DelegatingEngine(array(new TestEngine()));
7370
$delegatingEngine->stream('template.php', array('foo' => 'bar'));
7471
}
7572

@@ -155,3 +152,23 @@ private function getStreamingEngineMock($template, $supports)
155152
interface MyStreamingEngine extends StreamingEngineInterface, EngineInterface
156153
{
157154
}
155+
156+
class TestEngine implements EngineInterface
157+
{
158+
public function render($name, array $parameters = array())
159+
{
160+
}
161+
162+
public function exists($name)
163+
{
164+
}
165+
166+
public function supports($name)
167+
{
168+
return true;
169+
}
170+
171+
public function stream()
172+
{
173+
}
174+
}

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