19declare(strict_types=1);
67use PHPUnit\Framework\TestCase;
73 return new class ($set_root) extends
NullSet {
85 return $this->set_root;
93 public function getScaffoldsForElement(
ElementInterface $element): \Generator
102 return new class ($action, $data_value) extends
NullMarker {
103 public function __construct(
protected Action $action,
protected string $data_value)
107 public function action():
Action
109 return $this->action;
112 public function dataValue():
string
114 return $this->data_value;
128 return $this->test->getMarkerMock($action, $data_value);
139 protected array $my_elements;
143 protected array $steps;
144 protected int $step_index;
148 $this->my_elements = [$this->start_element];
149 $this->steps = iterator_to_array(
$path->steps());
150 $this->step_index = -1;
153 protected function filterElements(): void
155 foreach ($this->currentStep()->filters() as $filter) {
159 if ($filter->type() === FilterType::MDID) {
161 foreach ($this->my_elements as $element) {
162 foreach ($filter->values() as $value) {
163 if ($element->getMDID() === $value) {
164 $elements[] = $element;
169 $this->my_elements = $elements;
174 foreach ($this->my_elements as $element) {
175 foreach ($filter->values() as $value) {
176 if ($element->getData()->value() === $value) {
177 $elements[] = $element;
182 $this->my_elements = $elements;
185 if ($filter->type() === FilterType::INDEX) {
187 foreach ($filter->values() as $value) {
188 $value = (
int) $value;
189 if (0 <= $value && $value < count($this->my_elements)) {
190 $elements[] = $this->my_elements[$value];
193 $this->my_elements = $elements;
198 public function elementsAtFinalStep(): \Generator
200 $current = clone $this;
201 while ($current->hasNextStep()) {
202 $current = $current->nextStep();
204 yield
from $current->my_elements;
207 public function lastElement(): ?ElementInterface
209 $element_count = count($this->my_elements);
210 return ($element_count === 0) ? null : $this->my_elements[$element_count - 1];
213 public function nextStep(): ?NavigatorInterface
215 if (!$this->hasNextStep()) {
218 $clone = clone $this;
219 $clone->my_elements = [];
220 $clone->step_index = $clone->step_index + 1;
221 foreach ($this->my_elements as $element) {
222 array_push($clone->my_elements, ...$element->getSubElements());
224 $clone->filterElements();
228 public function currentStep(): ?StepInterface
230 return (0 <= $this->step_index && $this->step_index < count($this->steps)) ? $this->steps[$this->step_index] :
null;
233 public function lastElementAtFinalStep(): ?ElementInterface
235 $final_elements = iterator_to_array($this->elementsAtFinalStep());
236 $final_elements_count = count($final_elements);
237 return $final_elements_count > 0 ? $final_elements[$final_elements_count - 1] :
null;
240 public function previousStep(): ?NavigatorInterface
242 if (!$this->hasPreviousStep()) {
245 $clone = clone $this;
246 $clone->my_elements = [];
247 $clone->step_index = $clone->step_index - 1;
248 foreach ($this->my_elements as $element) {
249 $clone->my_elements[] = $element->getSuperElement();
254 public function hasNextStep(): bool
256 return ($this->step_index + 1) < count($this->steps);
259 public function hasPreviousStep(): bool
261 return ($this->step_index - 1) >= -1;
264 public function hasElements(): bool
266 return count($this->my_elements) > 0;
269 public function elements(): \Generator
271 yield
from $this->my_elements;
276 public function getPathConditionCollectionMock(PathInterface
$path): PathConditionsCollectionInterface
282 $path_conditions = [];
283 $collected_steps = [];
285 foreach (
$path->steps() as $step) {
288 $condition = array_pop($collected_steps);
289 $target = $collected_steps[count($collected_steps) - 1];
290 $condition_path_steps = [$condition];
292 if (key_exists($condition->name(), $path_conditions)) {
294 foreach ($path_conditions[$condition->name()]->steps() as $cond_step) {
295 $condition_path_steps[] = $cond_step;
298 unset($path_conditions[$condition->name()]);
301 if (key_exists($target->name(), $path_conditions)) {
303 foreach ($path_conditions[$target->name()]->steps() as $cond_step) {
304 $target_steps[] = $cond_step;
306 array_unshift($condition_path_steps, ...$target_steps);
307 unset($path_conditions[$target->name()]);
310 $path_conditions[$target->name()] = $this->
getPathMock(
311 $condition_path_steps,
317 $collected_steps[] = $step;
322 $this->
getPathMock($collected_steps,
false,
false),
324 ) extends NullPathConditionsCollection {
326 protected ManipulatorTest $test,
327 protected PathInterface $clear_path,
328 protected array $path_conditons
332 public function getPathWithoutConditions(): PathInterface
334 return $this->clear_path;
337 public function getConditionPathByStepName(
string $name): PathInterface
339 if (key_exists($name, $this->path_conditons)) {
340 return $this->path_conditons[$name];
342 return $this->test->getPathMock([],
true,
false);
351 $path_conditions_collection,
362 $navigator = $this->navigator_factory->navigator(
363 $this->path_conditions_collection->getConditionPathByStepName($step->
name()),
366 while (!is_null($navigator)) {
367 if (!$navigator->hasElements()) {
370 $navigator = $navigator->nextStep();
375 public function allPathConditionsAreMet(StepInterface $step, ElementInterface ...$roots): bool
377 foreach ($roots as $root) {
378 if (!$this->isPathConditionMet($step, $root)) {
385 public function atLeastOnePathConditionIsMet(StepInterface $step, ElementInterface ...$roots): bool
387 foreach ($roots as $root) {
388 if ($this->isPathConditionMet($step, $root)) {
395 public function getRootsThatMeetPathCondition(StepInterface $step, ElementInterface ...$roots): \Generator
398 foreach ($roots as $root) {
399 if ($this->isPathConditionMet($step, $root)) {
403 yield
from $elements;
417 return $this->test->getPathBuilderMock();
425 protected bool $is_relative;
426 protected bool $leads_to_exactly_one_element;
430 protected array $steps;
434 $this->is_relative =
false;
435 $this->leads_to_exactly_one_element =
false;
438 public function withLeadsToExactlyOneElement(
bool $leads_to_one): BuilderInterface
440 $builder = clone $this;
441 $builder->leads_to_exactly_one_element = $leads_to_one;
445 public function withRelative(
bool $is_relative): BuilderInterface
447 $builder = clone $this;
448 $builder->is_relative = $is_relative;
452 public function withNextStepFromStep(StepInterface $next_step,
bool $add_as_first =
false): BuilderInterface
454 $builder = clone $this;
455 $builder->steps[] = $next_step;
459 public function get(): PathInterface
461 return $this->test->getPathMock($this->steps, $this->is_relative, $this->leads_to_exactly_one_element);
475 return $this->test->getNavigatorMock(
$path, $start_element);
490 public function pathConditionChecker(
493 return $this->test->getPathConditionCheckerMock($path_conditions_collection);
498 return $this->test->getPathConditionCollectionMock(
$path);
505 return new class ($value, $type) extends
NullData {
506 public function __construct(
protected string $my_value,
protected Type $my_type)
510 public function value():
string
512 return $this->my_value;
515 public function type():
Type
517 return $this->my_type;
529 protected string $my_name,
530 protected
Type $data_type,
531 protected bool $is_unique
535 public function name(): string
537 return $this->my_name;
540 public function dataType():
Type
542 return $this->data_type;
545 public function unique(): bool
547 return $this->is_unique;
552 public function getElementMock(
556 bool $is_unique =
false
557 ): ElementInterface {
558 return new class ($this, $mdid, $value, $type, $is_unique) extends NullElement {
559 protected ?ElementInterface $parent;
560 protected ?MarkerInterface $marker;
561 protected DataInterface
$data;
562 protected DefinitionInterface $definition;
566 protected array $children;
569 protected ManipulatorTest $test,
570 protected int|
NoID $mdid,
575 $this->marker =
null;
576 $this->parent =
null;
577 $this->children = [];
578 $this->data = $this->test->getDataMock($value, $type);
579 $this->definition = $this->test->getDefinitionMock(
'', $this->data->type(), $is_unique);
582 public function getMDID():
int|
NoID
587 public function addChild(ElementInterface $child): void
589 $child->parent = $this;
590 $this->children[] = $child;
593 public function addChildren(ElementInterface ...$children): void
595 foreach ($children as $child) {
596 $this->addChild($child);
600 public function getSubElements(): \Generator
602 yield
from $this->children;
605 public function getSuperElement(): ?ElementInterface
607 return $this->parent;
610 public function addScaffoldToSubElements(ScaffoldProviderInterface $scaffold_provider,
string $name): ?ElementInterface
612 $element = $this->test->getElementMock(NoID::SCAFFOLD, $name,
Type::NULL);
613 $this->addChild($element);
617 public function getData(): DataInterface
622 public function mark(MarkerFactoryInterface $factory,
Action $action,
string $data_value =
''): void
624 $this->marker = $factory->marker($action, $data_value);
625 $element = $this->parent;
626 while (!is_null($element) && !$element->isMarked()) {
627 $current_action = ($element->isScaffold() && $action === Action::CREATE_OR_UPDATE) ? Action::CREATE_OR_UPDATE : Action::NEUTRAL;
628 $element->marker = $factory->marker($current_action);
629 $element = $element->parent;
633 public function getDefinition(): DefinitionInterface
635 return $this->definition;
639 public function getMarker(): ?MarkerInterface
641 return $this->marker;
644 public function isMarked(): bool
646 return !is_null($this->marker);
656 return new class ($steps, $is_relative, $leads_to_one) extends
NullPath {
661 protected array $my_steps,
662 protected bool $is_relative,
663 protected bool $leads_to_one
667 public function leadsToExactlyOneElement():
bool
669 return $this->leads_to_one;
672 public function isRelative():
bool
674 return $this->is_relative;
677 public function steps(): \Generator
679 yield
from $this->my_steps;
689 return new class ($step_name, $filter) extends
NullStep {
696 return $this->step_name;
699 public function filters(): \Generator
701 yield
from $this->my_filter;
708 return new class ($filter_type, $values) extends
NullFilter {
715 return $this->filter_type;
718 public function values(): \Generator
720 yield
from $this->my_values;
726 int $expected_child_count,
727 int|
NoID $expected_id,
728 string $expected_element_data_value,
730 ?
Action $expected_marker_action =
null,
731 string $exptected_marker_value =
'',
732 array $expected_child_values = [],
735 'expected_child_count' => $expected_child_count,
736 'expected_id' => $expected_id,
737 'expected_element_data_value' => $expected_element_data_value,
738 'expected_data_type' => $expected_data_type,
739 'expected_marker_action' => $expected_marker_action,
740 'expected_marker_value' => $exptected_marker_value,
741 'children' => $expected_child_values
745 protected function myAssertElement(
747 array $expected_values
757 $expected_child_count = $expected_values[
'expected_child_count'];
758 $expected_id = $expected_values[
'expected_id'];
759 $expected_element_data_value = $expected_values[
'expected_element_data_value'];
760 $expected_data_type = $expected_values[
'expected_data_type'];
761 $expected_marker_action = $expected_values[
'expected_marker_action'];
762 $expected_marker_value = $expected_values[
'expected_marker_value'];
763 $msg =
'Failed during check of element with data value: ' . $element_to_check->
getData()->value()
764 .
', and with NoID: ' . ($element_to_check->
getMDID() instanceof
NoID ? $element_to_check->
getMDID()->value : $element_to_check->
getMDID());
765 if (is_null($expected_marker_action)) {
766 $this->assertSame(
null, $element_to_check->
getMarker(), $msg);
768 if (!is_null($expected_marker_action)) {
769 $this->assertNotSame(
null, $element_to_check->
getMarker(), $msg);
770 $this->assertSame($expected_marker_action, $element_to_check->
getMarker()->action(), $msg);
771 $this->assertSame($expected_marker_value, $element_to_check->
getMarker()->dataValue(), $msg);
773 $this->assertSame($expected_child_count, count(iterator_to_array($element_to_check->
getSubElements())), $msg);
774 $this->assertSame($expected_id, $element_to_check->
getMDID(), $msg);
775 $this->assertSame($expected_element_data_value, $element_to_check->
getData()->value(), $msg);
776 $this->assertSame($expected_data_type, $element_to_check->
getData()->type(), $msg);
779 protected function myAssertTree(ElementInterface $root, array $expected_root_values)
786 $expected_values = [$expected_root_values];
787 while (count($elements) > 0) {
788 $this->assertSame(count($elements), count($expected_values),
'Bad test value initializion');
789 $current_element = array_pop($elements);
790 $current_expected_values = array_pop($expected_values);
791 $this->myAssertElement($current_element, $current_expected_values);
792 array_push($elements, ...$current_element->getSubElements());
793 array_push($expected_values, ...$current_expected_values[
'children']);
801 $this->getMarkerFactoryMock(),
802 $this->getNavigatorFactoryMock(),
803 $this->getPathFactoryMock(),
807 $element_root = $this->getElementMock(NoID::ROOT,
'root',
Type::NULL);
808 $element_general = $this->getElementMock(0,
'general',
Type::NULL);
809 $element_subsection_1_0 = $this->getElementMock(1,
'subsection_1',
Type::NULL);
810 $element_subsection_1_1 = $this->getElementMock(2,
'subsection_1',
Type::NULL);
811 $element_target_0 = $this->getElementMock(3,
'target', Type::STRING);
812 $element_target_1 = $this->getElementMock(4,
'target', Type::STRING);
813 $element_target_2 = $this->getElementMock(5,
'target', Type::STRING);
815 $element_root->addChildren($element_general);
816 $element_general->addChildren($element_subsection_1_0, $element_subsection_1_1);
817 $element_subsection_1_0->addChildren($element_target_0);
818 $element_subsection_1_1->addChildren($element_target_1, $element_target_2);
820 $set = $this->getSetMock($element_root);
821 $delete_path = $this->getPathMock(
823 $this->getStepMock(
'general', [
826 $this->getStepMock(
'subsection_1', [
828 $this->getFilterMock(FilterType::MDID, [2])
830 $this->getStepMock(
'target', [
839 $manipulator->prepareDelete($set, $delete_path);
841 $this->fail(
$e->getMessage());
844 $expected_element_target_2 = $this->createExpectedValuesArray(
852 $expected_element_target_1 = $this->createExpectedValuesArray(
860 $expected_element_target_0 = $this->createExpectedValuesArray(
867 $expected_element_subsection_1_1 = $this->createExpectedValuesArray(
875 $expected_element_target_1,
876 $expected_element_target_2
880 $expected_element_subsection_1_0 = $this->createExpectedValuesArray(
888 $expected_element_target_0
892 $expected_element_general = $this->createExpectedValuesArray(
900 $expected_element_subsection_1_0,
901 $expected_element_subsection_1_1
905 $expected_element_root = $this->createExpectedValuesArray(
913 $expected_element_general
917 $this->myAssertTree($element_root, $expected_element_root);
924 $this->getMarkerFactoryMock(),
925 $this->getNavigatorFactoryMock(),
926 $this->getPathFactoryMock(),
930 $element_root = $this->getElementMock(NoID::ROOT,
'root',
Type::NULL);
931 $element_general = $this->getElementMock(0,
'general',
Type::NULL);
932 $element_subsection_1_0 = $this->getElementMock(1,
'subsection_1',
Type::NULL);
933 $element_subsection_1_1 = $this->getElementMock(2,
'subsection_1',
Type::NULL);
934 $element_target = $this->getElementMock(3,
'target', Type::STRING);
936 $element_root->addChildren($element_general);
937 $element_general->addChildren($element_subsection_1_0, $element_subsection_1_1);
938 $element_subsection_1_0->addChildren($element_target);
940 $set = $this->getSetMock($element_root);
941 $delete_path = $this->getPathMock(
943 $this->getStepMock(
'general', [
946 $this->getStepMock(
'subsection_1', [
949 $this->getStepMock(
'i_do_not_exist_one', [
952 $this->getStepMock(
'i_do_not_exist_two', [
961 $manipulator->prepareDelete($set, $delete_path);
963 $this->fail(
$e->getMessage());
966 $expected_element_target = $this->createExpectedValuesArray(
973 $expected_element_subsection_1_1 = $this->createExpectedValuesArray(
979 $expected_element_subsection_1_0 = $this->createExpectedValuesArray(
987 $expected_element_target
991 $expected_element_general = $this->createExpectedValuesArray(
999 $expected_element_subsection_1_0,
1000 $expected_element_subsection_1_1
1004 $expected_element_root = $this->createExpectedValuesArray(
1012 $expected_element_general
1016 $this->myAssertTree($element_root, $expected_element_root);
1022 $this->getScaffoldProviderMock(),
1023 $this->getMarkerFactoryMock(),
1024 $this->getNavigatorFactoryMock(),
1025 $this->getPathFactoryMock(),
1026 $this->getPathUtilitiesFactoryMock()
1029 $path = $this->getPathMock([
1030 $this->getStepMock(
'general', [
1035 $element_root = $this->getElementMock(NoID::ROOT,
'root',
Type::NULL,
true);
1038 $manipulator->prepareCreateOrUpdate($this->getSetMock($element_root),
$path,
'test');
1040 $this->fail(
$e->getMessage());
1043 $expected_element_general = $this->createExpectedValuesArray(
1048 Action::CREATE_OR_UPDATE,
1052 $expected_element_root = $this->createExpectedValuesArray(
1060 $expected_element_general
1064 $this->myAssertTree($element_root, $expected_element_root);
1070 $this->getScaffoldProviderMock(),
1071 $this->getMarkerFactoryMock(),
1072 $this->getNavigatorFactoryMock(),
1073 $this->getPathFactoryMock(),
1074 $this->getPathUtilitiesFactoryMock()
1077 $add_path = $this->getPathMock([
1078 $this->getStepMock(
'general', [
1081 $this->getStepMock(
'tags', [
1084 $this->getStepMock(
'tag', [
1086 $this->getFilterMock(FilterType::INDEX, [0, 1])
1090 $element_root = $this->getElementMock(NoID::ROOT,
'root',
Type::NULL,
true);
1091 $element_general = $this->getElementMock(0,
'general',
Type::NULL,
true);
1092 $element_special = $this->getElementMock(1,
'special',
Type::NULL,
true);
1094 $element_root->addChildren($element_general, $element_special);
1097 $manipulator->prepareCreateOrUpdate($this->getSetMock($element_root), $add_path,
'test1',
'test2');
1099 $this->fail(
$e->getMessage());
1102 $expected_element_tag_1 = $this->createExpectedValuesArray(
1107 Action::CREATE_OR_UPDATE,
1111 $expected_element_tag_0 = $this->createExpectedValuesArray(
1116 Action::CREATE_OR_UPDATE,
1120 $expected_element_tags = $this->createExpectedValuesArray(
1125 Action::CREATE_OR_UPDATE,
1128 $expected_element_tag_0,
1129 $expected_element_tag_1
1133 $expected_element_special = $this->createExpectedValuesArray(
1139 $expected_element_general = $this->createExpectedValuesArray(
1147 $expected_element_tags
1151 $expected_element_root = $this->createExpectedValuesArray(
1159 $expected_element_general,
1160 $expected_element_special
1164 $this->myAssertTree($element_root, $expected_element_root);
1170 $this->getScaffoldProviderMock(),
1171 $this->getMarkerFactoryMock(),
1172 $this->getNavigatorFactoryMock(),
1173 $this->getPathFactoryMock(),
1174 $this->getPathUtilitiesFactoryMock()
1177 $add_path = $this->getPathMock([
1178 $this->getStepMock(
'general', [
1181 $this->getStepMock(
'tags', [
1184 $this->getStepMock(
'tag', [
1186 $this->getFilterMock(FilterType::INDEX, [0, 2])
1190 $element_root = $this->getElementMock(NoID::ROOT,
'root',
Type::NULL,
true);
1191 $element_general = $this->getElementMock(0,
'general',
Type::NULL,
true);
1192 $element_special = $this->getElementMock(1,
'special',
Type::NULL,
true);
1193 $element_tags = $this->getElementMock(2,
'tags',
Type::NULL,
true);
1194 $element_tag_0 = $this->getElementMock(3,
'tag', Type::STRING);
1195 $element_tag_1 = $this->getElementMock(4,
'tag', Type::STRING);
1196 $element_tag_2 = $this->getElementMock(5,
'tag', Type::STRING);
1197 $element_tag_3 = $this->getElementMock(6,
'tag', Type::STRING);
1199 $element_root->addChildren($element_general, $element_special);
1200 $element_general->addChildren($element_tags);
1201 $element_tags->addChildren($element_tag_0, $element_tag_1, $element_tag_2, $element_tag_3);
1204 $manipulator->prepareCreateOrUpdate($this->getSetMock($element_root), $add_path,
'test1',
'test2');
1206 $this->fail(
$e->getMessage());
1209 $expected_element_tag_3 = $this->createExpectedValuesArray(
1216 $expected_element_tag_2 = $this->createExpectedValuesArray(
1221 Action::CREATE_OR_UPDATE,
1225 $expected_element_tag_1 = $this->createExpectedValuesArray(
1232 $expected_element_tag_0 = $this->createExpectedValuesArray(
1237 Action::CREATE_OR_UPDATE,
1241 $expected_element_tags = $this->createExpectedValuesArray(
1249 $expected_element_tag_0,
1250 $expected_element_tag_1,
1251 $expected_element_tag_2,
1252 $expected_element_tag_3
1256 $expected_element_special = $this->createExpectedValuesArray(
1262 $expected_element_general = $this->createExpectedValuesArray(
1270 $expected_element_tags
1274 $expected_element_root = $this->createExpectedValuesArray(
1282 $expected_element_general,
1283 $expected_element_special
1287 $this->myAssertTree($element_root, $expected_element_root);
1293 $this->getScaffoldProviderMock(),
1294 $this->getMarkerFactoryMock(),
1295 $this->getNavigatorFactoryMock(),
1296 $this->getPathFactoryMock(),
1297 $this->getPathUtilitiesFactoryMock()
1300 $add_path = $this->getPathMock([
1301 $this->getStepMock(
'general', [
1304 $this->getStepMock(
'general_condition', [
1308 $this->getStepMock(
'tags', [
1311 $this->getStepMock(
'tag', [
1313 $this->getFilterMock(FilterType::INDEX, [0, 2])
1317 $element_root = $this->getElementMock(NoID::ROOT,
'root',
Type::NULL,
true);
1318 $element_general = $this->getElementMock(0,
'general',
Type::NULL,
true);
1319 $element_special = $this->getElementMock(1,
'special',
Type::NULL,
true);
1320 $element_general_condition = $this->getElementMock(2,
'general_condition',
Type::NULL);
1321 $element_tags = $this->getElementMock(3,
'tags',
Type::NULL,
true);
1322 $element_tag_0 = $this->getElementMock(4,
'tag', Type::STRING);
1323 $element_tag_1 = $this->getElementMock(5,
'tag', Type::STRING);
1324 $element_tag_2 = $this->getElementMock(6,
'tag', Type::STRING);
1325 $element_tag_3 = $this->getElementMock(7,
'tag', Type::STRING);
1327 $element_root->addChildren($element_general, $element_special);
1328 $element_general->addChildren($element_general_condition, $element_tags);
1329 $element_tags->addChildren($element_tag_0, $element_tag_1, $element_tag_2, $element_tag_3);
1332 $manipulator->prepareCreateOrUpdate($this->getSetMock($element_root), $add_path,
'test1',
'test2');
1334 $this->fail(
$e->getMessage());
1337 $expected_element_tag_3 = $this->createExpectedValuesArray(
1344 $expected_element_tag_2 = $this->createExpectedValuesArray(
1349 Action::CREATE_OR_UPDATE,
1353 $expected_element_tag_1 = $this->createExpectedValuesArray(
1360 $expected_element_tag_0 = $this->createExpectedValuesArray(
1365 Action::CREATE_OR_UPDATE,
1369 $expected_element_tags = $this->createExpectedValuesArray(
1377 $expected_element_tag_0,
1378 $expected_element_tag_1,
1379 $expected_element_tag_2,
1380 $expected_element_tag_3
1384 $expected_element_general_condition = $this->createExpectedValuesArray(
1390 $expected_element_special = $this->createExpectedValuesArray(
1396 $expected_element_general = $this->createExpectedValuesArray(
1404 $expected_element_general_condition,
1405 $expected_element_tags
1409 $expected_element_root = $this->createExpectedValuesArray(
1417 $expected_element_general,
1418 $expected_element_special
1422 $this->myAssertTree($element_root, $expected_element_root);
1428 $this->getScaffoldProviderMock(),
1429 $this->getMarkerFactoryMock(),
1430 $this->getNavigatorFactoryMock(),
1431 $this->getPathFactoryMock(),
1432 $this->getPathUtilitiesFactoryMock()
1435 $add_path = $this->getPathMock([
1436 $this->getStepMock(
'general', [
1439 $this->getStepMock(
'tags', [
1442 $this->getStepMock(
'tags_condition', [
1446 $this->getStepMock(
'tag', [
1451 $element_root = $this->getElementMock(NoID::ROOT,
'root',
Type::NULL,
true);
1452 $element_general = $this->getElementMock(0,
'general',
Type::NULL,
true);
1453 $element_special = $this->getElementMock(1,
'special',
Type::NULL,
true);
1454 $element_general_condition = $this->getElementMock(2,
'general_condition',
Type::NULL);
1455 $element_tags = $this->getElementMock(3,
'tags',
Type::NULL,
true);
1456 $element_tag_0 = $this->getElementMock(4,
'tag', Type::STRING);
1458 $element_root->addChildren($element_general, $element_special);
1459 $element_general->addChildren($element_general_condition, $element_tags);
1460 $element_tags->addChildren($element_tag_0);
1463 $manipulator->prepareCreateOrUpdate(
1464 $this->getSetMock($element_root),
1471 $this->fail(
$e->getMessage());
1474 $expected_element_tag_3 = $this->createExpectedValuesArray(
1479 Action::CREATE_OR_UPDATE,
1483 $expected_element_tag_2 = $this->createExpectedValuesArray(
1488 Action::CREATE_OR_UPDATE,
1492 $expected_element_tag_1 = $this->createExpectedValuesArray(
1497 Action::CREATE_OR_UPDATE,
1501 $expected_element_tag_0 = $this->createExpectedValuesArray(
1508 $expected_element_tags_condition = $this->createExpectedValuesArray(
1513 Action::CREATE_OR_UPDATE,
1517 $expected_element_tags_created = $this->createExpectedValuesArray(
1522 Action::CREATE_OR_UPDATE,
1525 $expected_element_tags_condition,
1526 $expected_element_tag_1,
1527 $expected_element_tag_2,
1528 $expected_element_tag_3
1532 $expected_element_tags = $this->createExpectedValuesArray(
1540 $expected_element_tag_0
1544 $expected_element_general_condition = $this->createExpectedValuesArray(
1550 $expected_element_special = $this->createExpectedValuesArray(
1556 $expected_element_general = $this->createExpectedValuesArray(
1564 $expected_element_general_condition,
1565 $expected_element_tags,
1566 $expected_element_tags_created
1570 $expected_element_root = $this->createExpectedValuesArray(
1578 $expected_element_general,
1579 $expected_element_special
1583 $this->myAssertTree($element_root, $expected_element_root);
1589 $this->getScaffoldProviderMock(),
1590 $this->getMarkerFactoryMock(),
1591 $this->getNavigatorFactoryMock(),
1592 $this->getPathFactoryMock(),
1593 $this->getPathUtilitiesFactoryMock()
1596 $add_path = $this->getPathMock([
1597 $this->getStepMock(
'general', [
1600 $this->getStepMock(
'tags', [
1603 $this->getStepMock(
'tags_condition', [
1607 $this->getStepMock(
'tag', [
1612 $element_root = $this->getElementMock(NoID::ROOT,
'root',
Type::NULL,
true);
1613 $element_general = $this->getElementMock(0,
'general',
Type::NULL,
true);
1614 $element_special = $this->getElementMock(1,
'special',
Type::NULL,
true);
1615 $element_general_condition = $this->getElementMock(2,
'general_condition',
Type::NULL);
1616 $element_tags = $this->getElementMock(3,
'tags',
Type::NULL,
true);
1617 $element_tag_0 = $this->getElementMock(4,
'tag', Type::STRING);
1618 $element_tags_condition = $this->getElementMock(5,
'tags_condition',
Type::NULL,
true);
1620 $element_root->addChildren($element_general, $element_special);
1621 $element_general->addChildren($element_general_condition, $element_tags);
1622 $element_tags->addChildren($element_tag_0, $element_tags_condition);
1625 $manipulator->prepareForceCreate(
1626 $this->getSetMock($element_root),
1633 $this->fail(
$e->getMessage());
1636 $expected_element_tag_3 = $this->createExpectedValuesArray(
1641 Action::CREATE_OR_UPDATE,
1645 $expected_element_tag_2 = $this->createExpectedValuesArray(
1650 Action::CREATE_OR_UPDATE,
1654 $expected_element_tag_1 = $this->createExpectedValuesArray(
1659 Action::CREATE_OR_UPDATE,
1663 $expected_element_tag_0 = $this->createExpectedValuesArray(
1670 $expected_element_tags_condition = $this->createExpectedValuesArray(
1677 $expected_element_tags = $this->createExpectedValuesArray(
1685 $expected_element_tag_0,
1686 $expected_element_tags_condition,
1687 $expected_element_tag_1,
1688 $expected_element_tag_2,
1689 $expected_element_tag_3
1693 $expected_element_general_condition = $this->createExpectedValuesArray(
1699 $expected_element_special = $this->createExpectedValuesArray(
1705 $expected_element_general = $this->createExpectedValuesArray(
1713 $expected_element_general_condition,
1714 $expected_element_tags
1718 $expected_element_root = $this->createExpectedValuesArray(
1726 $expected_element_general,
1727 $expected_element_special
1731 $this->myAssertTree($element_root, $expected_element_root);
1737 $this->getScaffoldProviderMock(),
1738 $this->getMarkerFactoryMock(),
1739 $this->getNavigatorFactoryMock(),
1740 $this->getPathFactoryMock(),
1741 $this->getPathUtilitiesFactoryMock()
1744 $add_path = $this->getPathMock([
1745 $this->getStepMock(
'general', [
1748 $this->getStepMock(
'tags', [
1751 $this->getStepMock(
'tag', [
1756 $element_root = $this->getElementMock(NoID::ROOT,
'root',
Type::NULL,
true);
1757 $element_general = $this->getElementMock(0,
'general',
Type::NULL,
true);
1758 $element_tags = $this->getElementMock(1,
'tags',
Type::NULL,
true);
1759 $element_tag_0 = $this->getElementMock(2,
'tag', Type::STRING);
1761 $element_root->addChildren($element_general);
1762 $element_general->addChildren($element_tags);
1763 $element_tags->addChildren($element_tag_0);
1766 $manipulator->prepareForceCreate(
1767 $this->getSetMock($element_root),
1774 $this->fail(
$e->getMessage());
1777 $expected_element_tag_3 = $this->createExpectedValuesArray(
1782 Action::CREATE_OR_UPDATE,
1786 $expected_element_tag_2 = $this->createExpectedValuesArray(
1791 Action::CREATE_OR_UPDATE,
1795 $expected_element_tag_1 = $this->createExpectedValuesArray(
1800 Action::CREATE_OR_UPDATE,
1804 $expected_element_tag_0 = $this->createExpectedValuesArray(
1811 $expected_element_tags = $this->createExpectedValuesArray(
1819 $expected_element_tag_0,
1820 $expected_element_tag_1,
1821 $expected_element_tag_2,
1822 $expected_element_tag_3
1826 $expected_element_general = $this->createExpectedValuesArray(
1834 $expected_element_tags
1838 $expected_element_root = $this->createExpectedValuesArray(
1846 $expected_element_general
1850 $this->myAssertTree($element_root, $expected_element_root);
__construct()
Constructor setup ILIAS global object @access public.
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc