Skip to content
Permalink
Browse files

tests: improvements

  • Loading branch information...
dg committed Nov 1, 2019
1 parent 4c303c1 commit 74469389eba98001b3ca80342620e5ce5320f42b
@@ -74,12 +74,12 @@ Assert::same([
// 'a' becoming 'b' parent
$a['b'] = $b;
Assert::same('b-c-d-e', $d['e']->lookupPath('A'));
Assert::same($a, $d['e']->lookup('A'));
Assert::same('b-c-d-e', $d['e']->lookupPath());
Assert::same('b-c-d-e', $d['e']->lookupPath(A::class));
Assert::same($a, $d['e']->lookup(A::class));
Assert::same('b-c-d-e', $d['e']->lookupPath(null));
Assert::same($a, $d['e']->lookup(null));
Assert::same('c-d-e', $d['e']->lookupPath('B'));
Assert::same($b, $d['e']->lookup('B'));
Assert::same('c-d-e', $d['e']->lookupPath(B::class));
Assert::same($b, $d['e']->lookup(B::class));
Assert::same($a['b-c'], $b['c']);
Notes::fetch(); // clear
@@ -91,7 +91,7 @@ Assert::same([
'ATTACHED(A, C)',
], Notes::fetch());
Assert::same('b-c-d-e', $a['b']['c']['d']['e']->lookupPath('A', false));
Assert::same('b-c-d-e', $a['b']['c']['d']['e']->lookupPath(A::class));
// ==> clone 'c'
@@ -101,9 +101,9 @@ Assert::same([
'detached(A, C)',
], Notes::fetch());
Assert::null($dolly['d']['e']->lookupPath('A', false));
Assert::null($dolly['d']['e']->lookupPathIfExists(A::class));
Assert::same('d-e', $dolly['d']['e']->lookupPath('C', false));
Assert::same('d-e', $dolly['d']['e']->lookupPath(C::class));
// ==> clone 'b'
@@ -75,7 +75,7 @@ Assert::same([
'C::ATTACHED(A)',
], Notes::fetch());
Assert::same('b-c-d-e', $a['b']['c']['d']['e']->lookupPath('A', false));
Assert::same('b-c-d-e', $a['b']['c']['d']['e']->lookupPath(A::class));
// ==> clone 'c'
@@ -85,9 +85,9 @@ Assert::same([
'C::detached(A)',
], Notes::fetch());
Assert::null($dolly['d']['e']->lookupPath('A', false));
Assert::null($dolly['d']['e']->lookupPathIfExists(A::class));
Assert::same('d-e', $dolly['d']['e']->lookupPath('C', false));
Assert::same('d-e', $dolly['d']['e']->lookupPath(C::class));
// ==> clone 'b'
@@ -44,7 +44,7 @@ $a['b']['c']['c2']['d'] = $d = new D;
// top
Assert::same($a, $d->lookup(null));
Assert::same($a, $d->lookupIfExists(null));
Assert::same('b-c-c2-d', $d->lookupPath());
Assert::same('b-c-c2-d', $d->lookupPath(null));
Assert::same('b-c-c2-d', $d->lookupPathIfExists(null));
// specified top
@@ -17,17 +17,6 @@ require __DIR__ . '/../bootstrap.php';
class TestClass extends Container implements ArrayAccess
{
use Nette\ComponentModel\ArrayAccess;
public function attached(IComponent $obj): void
{
Notes::add(get_class($this) . '::ATTACHED(' . get_class($obj) . ')');
}
public function detached(IComponent $obj): void
{
Notes::add(get_class($this) . '::detached(' . get_class($obj) . ')');
}
}
@@ -91,12 +80,12 @@ Assert::same([
// 'a' becoming 'b' parent
$a['b'] = $b;
Assert::same('b-c-d-e', $d['e']->lookupPath('A'));
Assert::same($a, $d['e']->lookup('A'));
Assert::same('b-c-d-e', $d['e']->lookupPath());
Assert::same('b-c-d-e', $d['e']->lookupPath(A::class));
Assert::same($a, $d['e']->lookup(A::class));
Assert::same('b-c-d-e', $d['e']->lookupPath(null));
Assert::same($a, $d['e']->lookup(null));
Assert::same('c-d-e', $d['e']->lookupPath('B'));
Assert::same($b, $d['e']->lookup('B'));
Assert::same('c-d-e', $d['e']->lookupPath(B::class));
Assert::same($b, $d['e']->lookup(B::class));
Assert::same($a['b-c'], $b['c']);
Notes::fetch(); // clear

0 comments on commit 7446938

Please sign in to comment.
You can’t perform that action at this time.