BaseTest.php 846 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. use PHPUnit\Framework\TestCase;
  3. use Docker\Composer\FileFormat2;
  4. use Symfony\Component\Yaml\Yaml;
  5. require __DIR__."/../vendor/autoload.php";
  6. class BaseTest extends TestCase
  7. {
  8. public function testSimpleUsage()
  9. {
  10. $composer = new FileFormat2();
  11. $composer->addService("Base")->image("ubuntu:16.10");
  12. $composer->addService("Ftth")->image("ubuntu:17.10");
  13. $composer->addService("ubuntu")->image("ubuntu");
  14. $composer->addService("custom")->build("./custom");
  15. $rtr = Yaml::parse($composer->render());
  16. $this->assertEquals(array (
  17. "version"=> "2.2",
  18. "services" => array ( "Base" => array("image" => "ubuntu:16.10"),
  19. "Ftth" => array ( "image" => "ubuntu:17.10"),
  20. "ubuntu" => array ( "image" => "ubuntu"),
  21. "custom" => array ( "build" => array("context" => "./custom")),
  22. )
  23. ), $rtr);
  24. }
  25. }