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
<?php
require_once __DIR__ . DIRECTORY_SEPARATOR . 'BaseCommandRunner.php';
class BuildTest extends BaseCommandRunner
{
protected function setUp()
{
$this->makeCommand('\Codeception\Command\Build');
$this->config = array(
'actor' => 'HobbitGuy',
'path' => 'tests/shire/',
'modules' => array('enabled' => array('Filesystem', 'EmulateModuleHelper')),
'include' => []
);
}
public function testBuild()
{
$this->execute();
$this->assertContains('class HobbitGuy extends \Codeception\Actor', $this->content);
// inherited methods from Actor
$this->assertContains('@method void wantTo($text)', $this->content);
$this->assertContains('@method void expectTo($prediction)', $this->content);
$this->content = $this->log[0]['content'];
// methods from Filesystem module
$this->assertContains('public function amInPath($path)', $this->content);
$this->assertContains('public function copyDir($src, $dst)', $this->content);
$this->assertContains('public function seeInThisFile($text)', $this->content);
// methods from EmulateHelper
$this->assertContains('public function seeEquals($expected, $actual)', $this->content);
$this->assertContains('HobbitGuyActions.php generated successfully.', $this->output);
$this->assertIsValidPhp($this->content);
}
public function testBuildNamespacedActor()
{
$this->config['namespace'] = 'Shire';
$this->execute();
$this->assertContains('namespace Shire;', $this->content);
$this->assertContains('class HobbitGuy extends \Codeception\Actor', $this->content);
$this->assertContains('use _generated\HobbitGuyActions;', $this->content);
$this->assertIsValidPhp($this->content);
}
}