Repository navigation
Expand file tree
/
Copy pathTestLoaderTest.php
More file actions
69 lines (59 loc) · 1.97 KB
/
Copy pathTestLoaderTest.php
File metadata and controls
69 lines (59 loc) · 1.97 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
<?php
class TestLoaderTest extends \PHPUnit_Framework_TestCase
{
/**
* @var \Codeception\TestLoader
*/
protected $testLoader;
protected function setUp()
{
$this->testLoader = new \Codeception\TestLoader(\Codeception\Configuration::dataDir());
}
/**
* @group core
*/
public function testAddCept() {
$this->testLoader->loadTest('SimpleCept.php');
$this->assertEquals(1, count($this->testLoader->getTests()));
}
public function testAddTest()
{
$this->testLoader->loadTest('SimpleTest.php');
$this->assertEquals(1, count($this->testLoader->getTests()));
}
public function testAddCeptAbsolutePath()
{
$this->testLoader->loadTest(codecept_data_dir('SimpleCept.php'));
$this->assertEquals(1, count($this->testLoader->getTests()));
}
/**
* @group core
*/
public function testLoadFileWithFewCases()
{
$this->testLoader->loadTest('SimpleNamespacedTest.php');
$this->assertEquals(3, count($this->testLoader->getTests()));
}
/**
* @group core
*/
public function testLoadAllTests()
{
$this->testLoader = new \Codeception\TestLoader(codecept_data_dir().'claypit/tests');
$this->testLoader->loadTests();
$this->assertContainsTestName('order/AnotherCept', $this->testLoader->getTests());
$this->assertContainsTestName('MageGuildCest::darkPower', $this->testLoader->getTests());
$this->assertContainsTestName('FailingTest::testMe', $this->testLoader->getTests());
}
protected function assertContainsTestName($name, $tests)
{
foreach ($tests as $test) {
if ($test instanceof \PHPUnit_Framework_TestCase) {
$testName = \Codeception\TestCase::getTestSignature($test);
if ($testName == $name) return;
codecept_debug($testName);
}
}
$this->fail("$name not found in tests");
}
}