ILIAS  trunk Revision v11.0_alpha-1866-gfa368f7776e
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\Tests\Setup\CLI\UpdateCommandTest Class Reference
+ Inheritance diagram for ILIAS\Tests\Setup\CLI\UpdateCommandTest:
+ Collaboration diagram for ILIAS\Tests\Setup\CLI\UpdateCommandTest:

Public Member Functions

 testBasicFunctionality ()
 
 testBasicFunctionalityAlreadyAchieved ()
 
 basicFunctionality (bool $is_applicable)
 

Detailed Description

Definition at line 29 of file UpdateCommandTest.php.

Member Function Documentation

◆ basicFunctionality()

ILIAS\Tests\Setup\CLI\UpdateCommandTest::basicFunctionality ( bool  $is_applicable)

Definition at line 40 of file UpdateCommandTest.php.

References ILIAS\UI\examples\Layout\Page\Standard\$refinery.

Referenced by ILIAS\Tests\Setup\CLI\UpdateCommandTest\testBasicFunctionality(), and ILIAS\Tests\Setup\CLI\UpdateCommandTest\testBasicFunctionalityAlreadyAchieved().

40  : void
41  {
42  $refinery = new Refinery($this->createMock(DataFactory::class), $this->createMock(\ilLanguage::class));
43 
44  $agent = $this->createMock(Setup\AgentCollection::class);
45  $config_reader = $this->createMock(Setup\CLI\ConfigReader::class);
46  $agent_finder = $this->createMock(Setup\AgentFinder::class);
47  $command = new Setup\CLI\UpdateCommand($agent_finder, $config_reader, []);
48 
49  $tester = new CommandTester($command);
50 
51  $config = $this->createMock(Setup\ConfigCollection::class);
52  $config_file = "config_file";
53  $config_file_content = ["config_file"];
54 
55  $objective = $this->createMock(Setup\Objective::class);
56  $env = $this->createMock(Setup\Environment::class);
57 
58  $config_reader
59  ->expects($this->once())
60  ->method("readConfigFile")
61  ->with($config_file)
62  ->willReturn($config_file_content);
63 
64  $agent_finder
65  ->expects($this->once())
66  ->method("getAgents")
67  ->with()
68  ->willReturn($agent);
69 
70  $agent
71  ->expects($this->once())
72  ->method("hasConfig")
73  ->willReturn(true);
74 
75  $agent
76  ->expects($this->once())
77  ->method("getArrayToConfigTransformation")
78  ->with()
79  ->willReturn($refinery->custom()->transformation(function ($v) use ($config_file_content, $config) {
80  $this->assertEquals($v, $config_file_content);
81  return $config;
82  }));
83 
84  $agent
85  ->expects($this->never())
86  ->method("getInstallObjective")
87  ->with($config)
88  ->willReturn(new Setup\Objective\NullObjective());
89 
90  $agent
91  ->expects($this->never())
92  ->method("getBuildObjective")
93  ->with()
94  ->willReturn(new Setup\Objective\NullObjective());
95 
96  $agent
97  ->expects($this->once())
98  ->method("getUpdateObjective")
99  ->with($config)
100  ->willReturn($objective);
101 
102  $objective
103  ->expects($this->once())
104  ->method("getPreconditions")
105  ->willReturn([]);
106 
107  $expects = $this->never();
108  $return = false;
109 
110  if ($is_applicable) {
111  $expects = $this->once();
112  $return = true;
113  }
114 
115  $objective
116  ->expects($expects)
117  ->method("achieve")
118  ->willReturn($env);
119 
120  $objective
121  ->expects($this->once())
122  ->method("isApplicable")
123  ->willReturn($return);
124 
125  $tester->execute([
126  "config" => $config_file
127  ]);
128  }
+ Here is the caller graph for this function:

◆ testBasicFunctionality()

ILIAS\Tests\Setup\CLI\UpdateCommandTest::testBasicFunctionality ( )

Definition at line 31 of file UpdateCommandTest.php.

References ILIAS\Tests\Setup\CLI\UpdateCommandTest\basicFunctionality().

31  : void
32  {
33  $this->basicFunctionality(false);
34  }
+ Here is the call graph for this function:

◆ testBasicFunctionalityAlreadyAchieved()

ILIAS\Tests\Setup\CLI\UpdateCommandTest::testBasicFunctionalityAlreadyAchieved ( )

Definition at line 36 of file UpdateCommandTest.php.

References ILIAS\Tests\Setup\CLI\UpdateCommandTest\basicFunctionality().

36  : void
37  {
38  $this->basicFunctionality(true);
39  }
+ Here is the call graph for this function:

The documentation for this class was generated from the following file: