Skip to content

Commit

Permalink
Refactor Importers tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed Mar 7, 2020
1 parent 46724eb commit 2096a62
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 19 deletions.
2 changes: 1 addition & 1 deletion spec/loophp/phptree/Importer/SimpleArraySpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function it_can_import(): void
$this
->import($array)
->count()
->shouldReturn(2);
->shouldReturn(3);

$this
->import($array)
Expand Down
21 changes: 3 additions & 18 deletions spec/loophp/phptree/Importer/TextSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@

namespace spec\loophp\phptree\Importer;

use InvalidArgumentException;
use loophp\phptree\Importer\Text;
use loophp\phptree\Node\AttributeNodeInterface;
use loophp\phptree\Node\ValueNode;
use loophp\phptree\Node\ValueNodeInterface;
use PhpSpec\ObjectBehavior;

class TextSpec extends ObjectBehavior
Expand All @@ -28,31 +27,17 @@ public function it_can_import(): void

$this
->import($string)
->shouldImplement(ValueNodeInterface::class);
->shouldImplement(AttributeNodeInterface::class);

$this
->import($string)
->count()
->shouldReturn(10);
->shouldReturn(11);

$this
->import($string)
->isRoot()
->shouldReturn(true);

$this
->import($string)
->getValue()
->shouldReturn('root');
}

public function it_can_throw_an_error_when_cannot_import(): void
{
$string = 'invalid string';

$this
->shouldThrow(InvalidArgumentException::class)
->during('import', [$string]);
}

public function it_is_initializable(): void
Expand Down

0 comments on commit 2096a62

Please sign in to comment.