Skip to content

Instantly share code, notes, and snippets.

@wowo
Created June 14, 2011 21:18
Show Gist options
  • Save wowo/1025913 to your computer and use it in GitHub Desktop.
Save wowo/1025913 to your computer and use it in GitHub Desktop.
Base test case with container (Symfony2)
<?php
require_once(__DIR__ . "/../../../../app/AppKernel.php");
class BaseTestCase extends \PHPUnit_Framework_TestCase
{
protected $_container;
public function __construct()
{
$kernel = new \AppKernel("test", true);
$kernel->boot();
$this->_container = $kernel->getContainer();
parent::__construct();
}
protected function get($service)
{
return $this->_container->get($service);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment