Last active
January 23, 2016 01:01
-
-
Save 0xMatt/19b9432a86c5737a5cd9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
doctrine: | |
dbal: | |
driver: pdo_sqlite | |
memory: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ImplementationTest extends TestCase | |
{ | |
public function setUp() | |
{ | |
parent::setUp(); | |
$this->setUpDb(); | |
} | |
public function testCreateReturnsNewUserWithValidParams() | |
{ | |
$client = static::createClient(); | |
// GET /foo - queries table from database for a list | |
$crawler = $client->request('GET', '/foo'); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Symfony\Bundle\FrameworkBundle\Console\Application; | |
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; | |
use Symfony\Component\Console\Input\StringInput; | |
use Symfony\Component\DependencyInjection\Container; | |
class TestCase extends WebTestCase | |
{ | |
/** | |
* @var Container | |
*/ | |
protected $container; | |
/** | |
* @var Application | |
*/ | |
protected $console; | |
public function setUp() | |
{ | |
static::bootKernel(); | |
$this->container = static::$kernel->getContainer(); | |
$this->console = new Application(static::$kernel); | |
$this->console->setAutoExit(false); | |
} | |
protected function runCommand($command) | |
{ | |
$command = sprintf('%s --quiet', $command); | |
$this->console->run( | |
new StringInput($command) | |
); | |
} | |
protected function setUpDb() | |
{ | |
$this->runCommand('doctrine:database:create --env=test'); | |
$this->runCommand('doctrine:schema:update --env=test --force'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment