/** * Test restart with project option */ public function testRestartWithprojectOption() { $composeFiles = new ComposeFileCollection(['docker-compose.test.yml']); $composeFiles->setProjectName('unittest'); $this->mockedManager->method('execute')->willReturn(array('output' => 'ok', 'code' => 0)); $this->assertEquals($this->mockedManager->restart($composeFiles), 'ok'); }
/** * Test run with project */ public function testRuntWithprojectOption() { $composeFiles = new ComposeFileCollection(['/var/www/docker-compose-test.yml']); $composeFiles->setProjectName('unittest'); $this->mockedManager->method('execute')->willReturn(array('output' => 'test', 'code' => 0)); $this->assertEquals($this->mockedManager->run('test', 'echo test', $composeFiles), "test"); }
/** * Test run with project, networking and network driver option */ public function testRuntWithprojectAndNetworkingWithDriverOption() { $composeFiles = new ComposeFileCollection(['docker-compose.test.yml']); $composeFiles->setProjectName('unittest')->setIsNetworking(true)->setNetworkDriver('overlay'); $this->manager->method('execute')->with('docker-compose -f docker-compose.test.yml --x-networking --x-network-driver overlay --project-name unittest run --rm test mycommand')->willReturn(array('output' => 'ok', 'code' => 0)); $this->assertEquals($this->manager->run('test', 'mycommand', $composeFiles), 'ok'); }
/** * Test run * @expectedException \DockerCompose\Exception\NoSuchServiceException */ public function testrunThrowNoSuchServiceException() { $composeFiles = new ComposeFileCollection(['/var/www/docker-compose-test.yml']); $composeFiles->setProjectName('unittest'); $this->manager->run('failedservice', 'echo test', $composeFiles); }