Added some tests and factory impl

This commit is contained in:
Michał Brzuchalski
2016-06-14 12:09:59 +02:00
parent 6e22a75a2e
commit e4982b5209
5 changed files with 228 additions and 21 deletions

View File

@@ -0,0 +1,38 @@
<?php
namespace spec\Madkom\NginxConfigurator;
use Madkom\NginxConfigurator\Builder;
use Madkom\NginxConfigurator\Config\Server;
use Madkom\NginxConfigurator\Config\Upstream;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
/**
* Class BuilderSpec
* @package spec\Madkom\NginxConfigurator
* @author Michał Brzuchalski <m.brzuchalski@madkom.pl>
* @mixin Builder
*/
class BuilderSpec extends ObjectBehavior
{
function it_is_initializable()
{
$this->shouldHaveType(Builder::class);
}
function it_can_build_with_Server_node(Server $server)
{
$server->__toString()->willReturn("server {
}");
$this->append($server);
$this->dump()->shouldBeString();
}
function it_can_build_with_Upstream_node(Upstream $upstream)
{
$upstream->__toString()->willReturn("upstream name {
}");
$this->append($upstream);
$this->dump()->shouldBeString();
}
}