-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
})(); | ||
|