Repository navigation
Expand file tree
/
Copy pathSuiteManagerTest.php
More file actions
73 lines (63 loc) · 2.39 KB
/
Copy pathSuiteManagerTest.php
File metadata and controls
73 lines (63 loc) · 2.39 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
use \Codeception\Util\Stub as Stub;
class SuiteManagerTest extends \PHPUnit_Framework_TestCase
{
/**
* @var \Codeception\SuiteManager
*/
protected $suiteman;
/**
* @var \Symfony\Component\EventDispatcher\EventDispatcher
*/
protected $dispatcher;
public function setUp() {
$this->dispatcher = new Symfony\Component\EventDispatcher\EventDispatcher;
$this->suiteman = Stub::make('\Codeception\SuiteManager', array(
'dispatcher' => $this->dispatcher,
'suite' => new PHPUnit_Framework_TestSuite(),
'settings' => array(
'bootstrap' => false,
'class_name' => 'CodeGuy',
'namespace' => '',
)));
}
/**
* @group core
*/
public function testRun() {
$events = array();
$this->dispatcher->addListener('suite.before', function ($e) use (&$events) { $events[] = $e->getName(); });
$this->dispatcher->addListener('suite.after', function ($e) use (&$events) { $events[] = $e->getName(); });
$runner = new \Codeception\PHPUnit\Runner;
$runner->setPrinter(new PHPUnit_TextUI_ResultPrinter($this->dispatcher));
$this->suiteman->run($runner, new \PHPUnit_Framework_TestResult, array('colors' => false, 'steps' => true, 'debug' => false));
$this->assertEquals($events, array('suite.before', 'suite.after'));
}
/**
* @group core
*/
public function testAddCest() {
$file = \Codeception\Configuration::dataDir().'SimpleCest.php';
$this->suiteman->addCest($file);
$this->assertEquals(2, $this->suiteman->getSuite()->count());
$file = \Codeception\Configuration::dataDir().'SimpleWithNoClassCest.php';
$this->suiteman->addCest($file);
$this->assertEquals(3, $this->suiteman->getSuite()->count());
}
/**
* @group core
*/
public function testAddCept() {
$file = $file = \Codeception\Configuration::dataDir().'SimpleCept.php';
$this->suiteman->addCept($file);
$this->assertEquals(1, $this->suiteman->getSuite()->count());
}
/**
* @group core
*/
public function testAddTest() {
$file = $file = \Codeception\Configuration::dataDir().'SimpleTest.php';
$this->suiteman->addTest($file);
$this->assertEquals(1, $this->suiteman->getSuite()->count());
}
}