BuildTest.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. require_once __DIR__ . DIRECTORY_SEPARATOR . 'BaseCommandRunner.php';
  3. class BuildTest extends BaseCommandRunner
  4. {
  5. protected function setUp()
  6. {
  7. $this->makeCommand('\Codeception\Command\Build');
  8. $this->config = array(
  9. 'actor' => 'HobbitGuy',
  10. 'path' => 'tests/shire/',
  11. 'modules' => array('enabled' => array('Filesystem', 'EmulateModuleHelper')),
  12. 'include' => []
  13. );
  14. }
  15. public function testBuild()
  16. {
  17. $this->execute();
  18. $this->assertContains('class HobbitGuy extends \Codeception\Actor', $this->content);
  19. // inherited methods from Actor
  20. $this->assertContains('@method void wantTo($text)', $this->content);
  21. $this->assertContains('@method void expectTo($prediction)', $this->content);
  22. $this->content = $this->log[0]['content'];
  23. // methods from Filesystem module
  24. $this->assertContains('public function amInPath($path)', $this->content);
  25. $this->assertContains('public function copyDir($src, $dst)', $this->content);
  26. $this->assertContains('public function seeInThisFile($text)', $this->content);
  27. // methods from EmulateHelper
  28. $this->assertContains('public function seeEquals($expected, $actual)', $this->content);
  29. $this->assertContains('HobbitGuyActions.php generated successfully.', $this->output);
  30. $this->assertIsValidPhp($this->content);
  31. }
  32. public function testBuildNamespacedActor()
  33. {
  34. $this->config['namespace'] = 'Shire';
  35. $this->execute();
  36. $this->assertContains('namespace Shire;', $this->content);
  37. $this->assertContains('class HobbitGuy extends \Codeception\Actor', $this->content);
  38. $this->assertContains('use _generated\HobbitGuyActions;', $this->content);
  39. $this->assertIsValidPhp($this->content);
  40. }
  41. }