forked from hechoendrupal/drupal-console
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApplicationTest.php
More file actions
72 lines (58 loc) · 1.99 KB
/
Copy pathApplicationTest.php
File metadata and controls
72 lines (58 loc) · 1.99 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
<?php
namespace Drupal\AppConsole\Test\Console;
use Symfony\Component\Console\Output\NullOutput;
use Symfony\Component\Console\Input\ArrayInput;
use Drupal\AppConsole\Console\Application;
class ApplicationTest extends \PHPUnit_Framework_TestCase
{
/**
* @var \Symfony\Component\Console\Helper\HelperSet
*/
protected $helperSet;
/**
* @var \Drupal\AppConsole\Command\Helper\BootstrapFinderHelper
*/
protected $bootstrapFinder;
/**
* @var \Drupal\AppConsole\Command\Helper\RegisterCommandsHelper
*/
protected $register_commands;
/**
* {@inheritdoc}
*/
protected function setUp()
{
$this->helperSet = $this
->getMockBuilder('Symfony\Component\Console\Helper\HelperSet')
->getMock();
$this->drupalAutoload = $this
->getMockBuilder('Drupal\AppConsole\Command\Helper\DrupalAutoloadHelper')
->disableOriginalConstructor()
->setMethods(['findAutoload', 'getDrupalRoot'])
->getMock();
$this->register_commands = $this
->getMockBuilder('Drupal\AppConsole\Command\Helper\RegisterCommandsHelper')
->disableOriginalConstructor()
->getMock();
}
public function testCanRunApplication()
{
$this->expectsThatAutoloadFinderHelperIsRegistered();
$config = $this
->getMockBuilder('Drupal\AppConsole\Config')
->disableOriginalConstructor()
->getMock();
$application = new Application($config);
$application->setAutoExit(false);
$application->setHelperSet($this->helperSet);
$application->setSearchSettingsFile(false);
$this->assertEquals(0, $application->run(new ArrayInput([]), new NullOutput()));
}
protected function expectsThatAutoloadFinderHelperIsRegistered()
{
$this->helperSet->expects($this->at(1))
->method('get')
->with('drupal-autoload')
->will($this->returnValue($this->drupalAutoload));
}
}