ILIAS  release_7 Revision v7.30-3-g800a261c036
Helper.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 2019 Richard Klees <richard.klees@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4
5namespace ILIAS\Tests\Setup;
6
9
10trait Helper
11{
12 protected function newAgent()
13 {
14 static $no = 0;
15
16 $consumer = $this
17 ->getMockBuilder(Setup\Agent::class)
18 ->setMethods(["hasConfig", "getDefaultConfig", "getConfigInput", "getArrayToConfigTransformation", "getInstallObjective", "getUpdateObjective", "getBuildArtifactObjective", "getStatusObjective", "getMigrations", "getNamedObjective"])
19 ->setMockClassName("Mock_AgentNo" . ($no++))
20 ->getMock();
21
22 return $consumer;
23 }
24
25 protected function newObjective()
26 {
27 static $no = 0;
28
29 $goal = $this
30 ->getMockBuilder(Setup\Objective::class)
31 ->setMethods(["getHash", "getLabel", "isNotable", "withResourcesFrom", "getPreconditions", "achieve", "isApplicable"])
32 ->setMockClassName("Mock_ObjectiveNo" . ($no++))
33 ->getMock();
34
35 $goal
36 ->method("getHash")
37 ->willReturn("" . $no);
38
39 return $goal;
40 }
41
42 protected function newInput()
43 {
44 static $no = 0;
45
46 $input = $this
47 ->getMockBuilder(Input::class)
48 ->setMethods([])
49 ->setMockClassName("Mock_InputNo" . ($no++))
50 ->getMock();
51
52 return $input;
53 }
54
55 protected function newConfig()
56 {
57 static $no = 0;
58
59 $config = $this
60 ->getMockBuilder(Setup\Config::class)
61 ->setMethods([])
62 ->setMockClassName("Mock_ConfigNo" . ($no++))
63 ->getMock();
64
65 return $config;
66 }
67}
An exception for terminatinating execution or to throw for unit testing.
This describes commonalities between all inputs.
Definition: Input.php:32
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:68
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...