8000 [2.7] fix mocks by xabbuh · Pull Request #18307 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[2.7] fix mocks #18307

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion phpunit
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/

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

use Symfony\Component\Process\ProcessUtils;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace Symfony\Component\Form\Tests\Extension\Validator;

use Symfony\Component\Form\Extension\Validator\ValidatorExtension;
use Symfony\Component\Validator\ValidatorInterface;

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

$validator
->expects($this->never())
->method('getMetadataFactory');
if ($validator instanceof ValidatorInterface) {
$validator
->expects($this->never())
->method('getMetadataFactory');
}

$extension = new ValidatorExtension($validator);
$guesser = $extension->loadTypeGuesser();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function testEventIsIgnoredIfUsernameIsNotPassedWithTheRequest()
$this->request->expects($this->any())->method('get')->with('_switch_user')->will($this->returnValue(null));

$this->event->expects($this->never())->method('setResponse');
$this->securityContext->expects($this->never())->method('setToken');
$this->tokenStorage->expects($this->never())->method('setToken');
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will fix the conflict during merging 2.3 into 2.7


$listener = new SwitchUserListener($this->tokenStorage, $this->userProvider, $this->userChecker, 'provider123', $this->accessDecisionManager);
$listener->handle($this->event);
Expand Down
25 changes: 21 additions & 4 deletions src/Symfony/Component/Templating/Tests/DelegatingEngineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,7 @@ public function testStreamDelegatesToSupportedEngine()
*/
public function testStreamRequiresStreamingEngine()
{
$engine = $this->getEngineMock('template.php', true);
$engine->expects($this->never())->method('stream');

$delegatingEngine = new DelegatingEngine(array($engine));
$delegatingEngine = new DelegatingEngine(array(new TestEngine()));
$delegatingEngine->stream('template.php', array('foo' => 'bar'));
}

Expand Down Expand Up @@ -155,3 +152,23 @@ private function getStreamingEngineMock($template, $supports)
interface MyStreamingEngine extends StreamingEngineInterface, EngineInterface
{
}

class TestEngine implements EngineInterface
{
public function render($name, array $parameters = array())
{
}

public function exists($name)
{
}

public function supports($name)
{
return true;
}

public function stream()
{
}
}
0