Skip to content

Commit

Permalink
fixed a test
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Oct 9, 2013
1 parent d221a69 commit 8bee688
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,32 @@

namespace Symfony\Bundle\FrameworkBundle\Tests\Templating\Helper;

use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
use Symfony\Bundle\FrameworkBundle\Templating\Helper\SessionHelper;

class SessionHelperTest extends \PHPUnit_Framework_TestCase
{
protected $request;
protected $requestStack;

protected function setUp()
{
$this->request = new Request();
$this->requestStack = new RequestStack();

This comment has been minimized.

Copy link
@jakzal

jakzal Oct 9, 2013

Contributor

@fabpot these changes actually broke several tests, since the SessionHelper is not using the RequestStack (yet?).

This comment has been minimized.

Copy link
@stof

stof Oct 9, 2013

Member

yeah, it seems to have been commited to the wrong branch

This comment has been minimized.

Copy link
@fabpot

fabpot Oct 10, 2013

Author Member

oops, wrong manipulation, reverting now.


$session = new Session(new MockArraySessionStorage());
$session->set('foobar', 'bar');
$session->getFlashBag()->set('notice', 'bar');

$this->request->setSession($session);
}

protected function tearDown()
{
$this->request = null;
$request = new Request();
$request->setSession($session);
$this->requestStack->push($request);
}

public function testFlash()
{
$helper = new SessionHelper($this->request);
$helper = new SessionHelper($this->requestStack);

$this->assertTrue($helper->hasFlash('notice'));

Expand All @@ -47,13 +45,13 @@ public function testFlash()

public function testGetFlashes()
{
$helper = new SessionHelper($this->request);
$helper = new SessionHelper($this->requestStack);
$this->assertEquals(array('notice' => array('bar')), $helper->getFlashes());
}

public function testGet()
{
$helper = new SessionHelper($this->request);
$helper = new SessionHelper($this->requestStack);

$this->assertEquals('bar', $helper->get('foobar'));
$this->assertEquals('foo', $helper->get('bar', 'foo'));
Expand All @@ -63,7 +61,7 @@ public function testGet()

public function testGetName()
{
$helper = new SessionHelper($this->request);
$helper = new SessionHelper($this->requestStack);

$this->assertEquals('session', $helper->getName());
}
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Console/Tests/ApplicationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public function testAdd()
}

/**
* @expectedException InvalidArgumentException
* @expectedException LogicException
* @expectedExceptionMessage You must call the parent constructor in "Foo5Command::__construct()"
*/
public function testAddCommandWithEmptyContructor()
Expand Down

0 comments on commit 8bee688

Please sign in to comment.