Skip to content

Commit

Permalink
basic tests
Browse files Browse the repository at this point in the history
  • Loading branch information
PlanetHoster-account committed Mar 14, 2019
1 parent c574040 commit 07f957c
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 0 deletions.
22 changes: 22 additions & 0 deletions spec/PlanetHoster/Api/DomainSpec.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace spec\PlanetHoster\Api;

use PlanetHoster\Api\Domain;
use PlanetHoster\Adapter\Adapter;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;

class DomainSpec extends ObjectBehavior
{

function let(Adapter $adapter)
{
$this->beConstructedWith($adapter);
}

function it_is_initializable()
{
$this->shouldHaveType(Domain::class);
}
}
44 changes: 44 additions & 0 deletions spec/PlanetHoster/Api/WorldSpec.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

namespace spec\PlanetHoster\Api;

use PlanetHoster\Api\World;
use PlanetHoster\Adapter\Adapter;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;

class WorldSpec extends ObjectBehavior
{

function let(Adapter $adapter)
{
$this->beConstructedWith($adapter);
}

function it_is_initializable()
{
$this->shouldHaveType(World::class);
}

function it_should_return_accounts(Adapter $adapter)
{
$adapter->get('/world-api/get-accounts')
->willReturn('
{
"nb_active_or_suspended_accounts":5,
"total_available_ressources":{
"cpu":177,
"mem":482,
"io":482
},
"world_accounts":[],
"reseller_id":"a1b2c3"
}
');

$accounts = $this->GetAccounts();
$accounts->shouldReturnAnInstanceOf('stdClass');
$accounts->world_accounts->shouldBeArray();
$accounts->world_accounts->shouldHaveCount(0);
}
}
15 changes: 15 additions & 0 deletions spec/PlanetHoster/Entity/DnsRecordSpec.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace spec\PlanetHoster\Entity;

use PlanetHoster\Entity\DnsRecord;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;

class DnsRecordSpec extends ObjectBehavior
{
function it_is_initializable()
{
$this->shouldHaveType(DnsRecord::class);
}
}
15 changes: 15 additions & 0 deletions spec/PlanetHoster/Entity/DomainContactSpec.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace spec\PlanetHoster\Entity;

use PlanetHoster\Entity\DomainContact;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;

class DomainContactSpec extends ObjectBehavior
{
function it_is_initializable()
{
$this->shouldHaveType(DomainContact::class);
}
}

0 comments on commit 07f957c

Please sign in to comment.