ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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
11use ILIAS\Refinery\Factory as Refinery;
12use ILIAS\Data\Factory as DataFactory;
13
14trait Helper
15{
16 protected function newAgent()
17 {
18 static $no = 0;
19
20 $consumer = $this
21 ->getMockBuilder(Setup\Agent::class)
22 ->setMethods(["hasConfig", "getDefaultConfig", "getConfigInput", "getArrayToConfigTransformation", "getInstallObjective", "getUpdateObjective", "getBuildArtifactObjective"])
23 ->setMockClassName("Mock_AgentNo" . ($no++))
24 ->getMock();
25
26 return $consumer;
27 }
28
29 protected function newObjective()
30 {
31 static $no = 0;
32
33 $goal = $this
34 ->getMockBuilder(Setup\Objective::class)
35 ->setMethods(["getHash", "getLabel", "isNotable", "withResourcesFrom", "getPreconditions", "achieve"])
36 ->setMockClassName("Mock_ObjectiveNo" . ($no++))
37 ->getMock();
38
39 $goal
40 ->method("getHash")
41 ->willReturn("" . $no);
42
43 return $goal;
44 }
45
46 protected function newInput()
47 {
48 static $no = 0;
49
50 $input = $this
51 ->getMockBuilder(Input::class)
52 ->setMethods([])
53 ->setMockClassName("Mock_InputNo" . ($no++))
54 ->getMock();
55
56 return $input;
57 }
58
59 protected function newConfig()
60 {
61 static $no = 0;
62
63 $config = $this
64 ->getMockBuilder(Setup\Config::class)
65 ->setMethods([])
66 ->setMockClassName("Mock_ConfigNo" . ($no++))
67 ->getMock();
68
69 return $config;
70 }
71}
An exception for terminatinating execution or to throw for unit testing.
Builds data types.
Definition: Factory.php:20
A transformation is a function from one datatype to another.
This is what a factory for input fields looks like.
Definition: Factory.php:11
This describes commonalities between all inputs.
Definition: Input.php:32
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:68