19declare(strict_types=1);
23use PHPUnit\Framework\TestCase;
40 return new class () extends
NullSet {
41 public array $prepared_changes = [];
49 protected int $obj_id,
50 protected int $sub_id,
51 protected string $type
55 public function objID():
int
60 public function subID():
int
65 public function type():
string
75 public function prepareCreateOrUpdate(
81 $set->prepared_changes[] = [
82 'path' =>
$path->toString(),
91 $set->prepared_changes[] = [
'delete should not be prepared!'];
95 public function prepareForceCreate(
101 $set->prepared_changes[] = [
'force create should not be prepared!'];
106 $builder =
new class () extends NullPathBuilder {
107 protected string $path_string =
'~start~';
109 public function withNextStep(
string $name,
bool $add_as_first =
false): PathBuilder
111 $builder = clone $this;
113 $name .=
'[added as first]';
115 $builder->path_string .=
'%' . $name;
119 public function withAdditionalFilterAtCurrentStep(
FilterType $type,
string ...$values): PathBuilder
121 $builder = clone $this;
122 $builder->path_string .=
'{' . $type->value .
':' . implode(
'><', $values) .
'}';
128 return new class ($this->path_string) extends
NullPath {
129 public function __construct(
protected string $path_string)
135 return $this->path_string;
141 $path_factory =
new class ($builder) extends NullPathFactory {
142 public function __construct(
protected PathBuilder $builder)
146 public function custom(): PathBuilder
148 return $this->builder;
153 protected function getInstallID():
string
166 $prepared_set = $identifier_handler->prepareUpdateOfIdentifier($set, $ressource_id);
168 $expected_entry_changes = [
169 'path' =>
'~start~%general%identifier{index:0}%entry',
170 'values' => [
'il_MockInstID_TargetType_983']
172 $expected_catalog_changes = [
173 'path' =>
'~start~%general%identifier{index:0}%catalog',
174 'values' => [
'ILIAS']
176 $prepared_changes = $prepared_set->prepared_changes;
177 $this->assertCount(2, $prepared_changes);
178 $this->assertContains($expected_entry_changes, $prepared_changes);
179 $this->assertContains($expected_catalog_changes, $prepared_changes);
188 $prepared_set = $identifier_handler->prepareUpdateOfIdentifier($set, $ressource_id);
190 $expected_entry_changes = [
191 'path' =>
'~start~%general%identifier{index:0}%entry',
192 'values' => [
'il_MockInstID_TargetType_78']
194 $expected_catalog_changes = [
195 'path' =>
'~start~%general%identifier{index:0}%catalog',
196 'values' => [
'ILIAS']
198 $prepared_changes = $prepared_set->prepared_changes;
199 $this->assertCount(2, $prepared_changes);
200 $this->assertContains($expected_entry_changes, $prepared_changes);
201 $this->assertContains($expected_catalog_changes, $prepared_changes);
__construct()
Constructor setup ILIAS global object @access public.