예제 #1
0
 public function test_get_path_returns_full_path()
 {
     $root = vfsStream::setup('projectDir');
     $helper = new PathHelper();
     $helper->setProjectPath($root->url());
     $fullPath = $helper->getPath($relative = 'relative/path.txt');
     static::assertEquals($root->url() . DIRECTORY_SEPARATOR . $relative, $fullPath);
 }
예제 #2
0
 public function test_working_dir_changes_with_command_and_terminate_events()
 {
     $oldCwd = getcwd();
     $this->pathHelper->expects(static::once())->method('setProjectPath')->with($this->projectPath);
     $commandEvent = new ConsoleCommandEvent($this->command, $this->input, $this->output);
     $this->dispatcher->dispatch(ConsoleEvents::COMMAND, $commandEvent);
     static::assertEquals($this->projectPath, getcwd());
     $terminateEvent = new ConsoleTerminateEvent($this->command, $this->input, $this->output, 0);
     $this->dispatcher->dispatch(ConsoleEvents::TERMINATE, $terminateEvent);
     static::assertEquals($oldCwd, getcwd());
 }
예제 #3
0
 protected function setUp()
 {
     parent::setUp();
     $this->inputMock = static::getMock(InputInterface::class);
     $this->outputMock = static::getMock(OutputInterface::class);
     $this->packageMock = static::getMock(PackageHelper::class);
     $this->requireMock = static::getMock(RequireHelper::class);
     $this->pathMock = static::getMock(PathHelper::class);
     $this->questionMock = Mockery::mock(QuestionHelper::class)->makePartial();
     $root = vfsStream::setup('projectDir');
     $this->configPath = $root->url() . '/phpunit.xml.dist';
     $this->pathMock->expects(static::any())->method('getPath')->with('phpunit.xml.dist')->willReturn($this->configPath);
     $this->factoryMock = static::getMockBuilder(ConfigurationFactory::class)->disableProxyingToOriginalMethods()->getMock();
     $helperSet = new HelperSet();
     $helperSet->set($this->questionMock, 'question');
     $helperSet->set($this->packageMock, 'package');
     $helperSet->set($this->requireMock, 'composer require');
     $helperSet->set($this->pathMock, 'path');
     $this->sut = new PhpUnitCommand($this->factoryMock);
     $this->sut->setHelperSet($helperSet);
 }