forked from Kunstmaan/KunstmaanBundlesCMS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TestListener.php
58 lines (45 loc) · 1.63 KB
/
TestListener.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
class TestListener implements \PHPUnit_Framework_TestListener
{
public function startTest(PHPUnit_Framework_Test $test)
{
}
public function endTest(PHPUnit_Framework_Test $test, $length)
{
}
public function addError(PHPUnit_Framework_Test $test, Exception $e, $time)
{
}
public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
{
}
public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $time)
{
}
public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time)
{
}
public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time)
{
}
public function startTestSuite(PHPUnit_Framework_TestSuite $suite)
{
$kernel = new \AppKernel('phpunit', true);
$kernel->boot();
// drop/create database schema
$em = $kernel->getContainer()->get('doctrine.orm.default_entity_manager');
$meta = $em->getMetadataFactory()->getAllMetadata();
$tool = new \Doctrine\ORM\Tools\SchemaTool($em);
$tool->dropSchema($meta);
$tool->createSchema($meta);
// insert fixtures
$fixtures = array('src/Kunstmaan/TranslatorBundle/Tests/files/fixtures.yml');
$em = $kernel->getContainer()->get('doctrine.orm.default_entity_manager');
$objects = \Nelmio\Alice\Fixtures::load($fixtures, $em);
$persister = new \Nelmio\Alice\ORM\Doctrine($em);
$persister->persist($objects);
}
public function endTestSuite(PHPUnit_Framework_TestSuite $suite)
{
}
}