Skip to content

Commit

Permalink
draft
Browse files Browse the repository at this point in the history
  • Loading branch information
dakujem committed Jan 27, 2024
1 parent a5d4190 commit 26b79ae
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions tests/implementation.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?php

declare(strict_types=1);

namespace Dakujem\Test;

use Dakujem\Oliva\DataNodeContract;
use Dakujem\Oliva\TreeNodeContract;
use Tester\Assert;

require_once __DIR__ . '/setup.php';

// TODO test other implementations than `Node` (to test compliance)


class BareNode implements TreeNodeContract
{
public function parent(): ?TreeNodeContract
{
// TODO: Implement parent() method.
}

public function children(): iterable
{
// TODO: Implement children() method.
}

public function hasChild(int|string|TreeNodeContract $child): bool
{
// TODO: Implement hasChild() method.
}

public function child(int|string $key): ?TreeNodeContract
{
// TODO: Implement child() method.
}

public function childKey(TreeNodeContract $node): string|int|null
{
// TODO: Implement childKey() method.
}

public function isLeaf(): bool
{
// TODO: Implement isLeaf() method.
}

public function isRoot(): bool
{
// TODO: Implement isRoot() method.
}

public function root(): TreeNodeContract
{
// TODO: Implement root() method.
}

}

(function () {
$a = new BareNode();
Assert::type(TreeNodeContract::class, $a);
Assert::false($a instanceof DataNodeContract);
})();

0 comments on commit 26b79ae

Please sign in to comment.