public function testRunDaemon()
 {
     $container = new Container(['Image' => 'ubuntu:precise', 'Cmd' => ['/bin/true']]);
     $manager = $this->getMockBuilder('\\Docker\\Manager\\ContainerManager')->setMethods(array('create', 'start', 'wait'))->disableOriginalConstructor()->getMock();
     $container->setExitCode(0);
     $manager->expects($this->once())->method('create')->with($this->isInstanceOf('\\Docker\\Container'))->will($this->returnSelf());
     $manager->expects($this->once())->method('start')->with($this->isInstanceOf('\\Docker\\Container'))->will($this->returnSelf());
     $manager->expects($this->never())->method('wait');
     $this->assertNull($manager->run($container, null, array(), true));
 }
 /**
  * Wait for a container to finish
  *
  * @param \Docker\Container $container
  * @param integer|null      $timeout
  *
  * @throws \Docker\Exception\UnexpectedStatusCodeException
  *
  * @return \Docker\Manager\ContainerManager
  */
 public function wait(Container $container, $timeout = null)
 {
     $response = $this->client->post(['/containers/{id}/wait', ['id' => $container->getId()]], ['timeout' => null === $timeout ? $this->client->getDefaultOption('timeout') : $timeout]);
     if ($response->getStatusCode() !== "200") {
         throw UnexpectedStatusCodeException::fromResponse($response);
     }
     $container->setExitCode($response->json()['StatusCode']);
     $this->inspect($container);
     return $this;
 }