ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
Helper.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\Tests\Setup;
22
23use ILIAS\Setup;
25
26trait Helper
27{
28 protected function newAgent(): Setup\Agent
29 {
30 static $no = 0;
31
32 $consumer = $this
33 ->getMockBuilder(Setup\Agent::class)
34 ->onlyMethods(["hasConfig", "getArrayToConfigTransformation", "getInstallObjective", "getUpdateObjective", "getBuildObjective", "getStatusObjective", "getMigrations", "getNamedObjectives"])
35 ->setMockClassName("Mock_AgentNo" . ($no++))
36 ->getMock();
37
38 return $consumer;
39 }
40
41 protected function newObjectiveConstructor(): Setup\ObjectiveConstructor
42 {
43 static $no = 0;
44 return new Setup\ObjectiveConstructor("named-objective-" . ($no++), static function () {
45 return self::newObjective();
46 });
47 }
48
49 protected function newObjective(): Setup\Objective
50 {
51 static $no = 0;
52
53 $goal = $this
54 ->getMockBuilder(Setup\Objective::class)
55 ->onlyMethods(["getHash", "getLabel", "isNotable", "getPreconditions", "achieve", "isApplicable"])
56 ->setMockClassName("Mock_" . md5(get_class($this)) . "_ObjectiveNo" . ($no++))
57 ->getMock();
58
59 $goal
60 ->method("getHash")
61 ->willReturn("" . $no);
62
63 return $goal;
64 }
65
66 protected function newInput(): InputField
67 {
68 static $no = 0;
69
70 $input = $this
71 ->getMockBuilder(InputField::class)
72 ->onlyMethods([])
73 ->setMockClassName("Mock_InputNo" . ($no++))
74 ->getMock();
75
76 return $input;
77 }
78
79 protected function newConfig(): Setup\Config
80 {
81 static $no = 0;
82
83 $config = $this
84 ->getMockBuilder(Setup\Config::class)
85 ->onlyMethods([])
86 ->setMockClassName("Mock_" . md5(get_class($this)) . "_ConfigNo" . ($no++))
87 ->getMock();
88
89 return $config;
90 }
91}
This describes inputs that can be used in forms.
Definition: FormInput.php:33
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...