|
| build (array $data, $node_id) |
|
◆ build()
ilStudyProgrammeProgressTreeTest::build |
( |
array |
$data, |
|
|
|
$node_id |
|
) |
| |
|
protected |
◆ setUp()
ilStudyProgrammeProgressTreeTest::setUp |
( |
| ) |
|
◆ testPGSTreeCreation()
ilStudyProgrammeProgressTreeTest::testPGSTreeCreation |
( |
| ) |
|
Definition at line 66 of file ilStudyProgrammeProgressTreeTest.php.
69 $this->assertEquals($n->getId(),
'top');
70 $this->assertInstanceOf(Node::class, $n->getSubnode(
'1.1'));
73 [
'top',
'1.2',
'1.2.2'],
74 $n->getSubnode(
'1.2')->getSubnode(
'1.2.2')->getPath()
78 [
'top',
'1.2',
'1.2.1'],
79 $n->findSubnodePath(
'1.2.1')
◆ testPGSTreeZipperManipulateAll()
ilStudyProgrammeProgressTreeTest::testPGSTreeZipperManipulateAll |
( |
| ) |
|
Definition at line 126 of file ilStudyProgrammeProgressTreeTest.php.
128 $zipper =
new Zipper($this->topnode);
130 ->modifyAll(fn ($n) => $n->withScore(count($n->getSubnodes())))
133 $this->assertEquals(2, $modified->getScore());
134 $this->assertEquals(0, $modified->getSubnode(
'1.1')->getScore());
135 $this->assertEquals(2, $modified->getSubnode(
'1.2')->getScore());
136 $this->assertEquals(1, $modified->getSubnode(
'1.2')->getSubnode(
'1.2.1')->getScore());
137 $this->assertEquals(0, $modified->getSubnode(
'1.2')->getSubnode(
'1.2.1')->getSubnode(
'1.2.1.1')->getScore());
138 $this->assertEquals(0, $modified->getSubnode(
'1.2')->getSubnode(
'1.2.2')->getScore());
◆ testPGSTreeZipperManipulation()
ilStudyProgrammeProgressTreeTest::testPGSTreeZipperManipulation |
( |
| ) |
|
Definition at line 97 of file ilStudyProgrammeProgressTreeTest.php.
References $path.
99 $zipper =
new Zipper($this->topnode);
101 $path = $this->topnode->findSubnodePath(
'1.2.1');
103 ->toPath(
$path)->modifyFocus(fn ($n) => $n->withScore(7))
104 ->toParent()->modifyFocus(fn ($n) => $n->withScore(6))
107 $zipper =
new Zipper($modified);
108 $other_path = $this->topnode->findSubnodePath(
'1.1');
110 ->toPath($other_path)->modifyFocus(fn ($n) => $n->withScore(8))
112 $this->assertEquals(7, $modified->getSubnode(
'1.2')->getSubnode(
'1.2.1')->getScore());
113 $this->assertEquals(6, $modified->getSubnode(
'1.2')->getScore());
114 $this->assertEquals(8, $modified->getSubnode(
'1.1')->getScore());
117 $zipper =
new Zipper($modified);
119 ->toPath(
$path)->modifyFocus(fn ($n) => $n->withScore(17))
121 $this->assertEquals(17, $modified->getSubnode(
'1.2')->getSubnode(
'1.2.1')->getScore());
122 $this->assertEquals(6, $modified->getSubnode(
'1.2')->getScore());
123 $this->assertEquals(8, $modified->getSubnode(
'1.1')->getScore());
◆ testPGSTreeZipperNav()
ilStudyProgrammeProgressTreeTest::testPGSTreeZipperNav |
( |
| ) |
|
Definition at line 83 of file ilStudyProgrammeProgressTreeTest.php.
85 $zipper =
new Zipper($this->topnode);
86 $this->assertInstanceOf(Zipper::class, $zipper->toChild(
'1.1'));
87 $this->assertInstanceOf(
89 $zipper->toPath($this->topnode->findSubnodePath(
'1.2.1'))->toParent()
91 $this->assertInstanceOf(
93 $zipper->toPath($this->topnode->findSubnodePath(
'1.2.1'))->getRoot()
The documentation for this class was generated from the following file: