ILIAS  release_7 Revision v7.30-3-g800a261c036
HasConfigReaderTest.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 2019 Daniel Weise <daniel.weise@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4 
5 namespace ILIAS\Tests\Setup\CLI;
6 
13 
15 {
16  protected $has_config_reader;
17 
18  public function setUp() : void
19  {
20  $this->config_reader = $this->createMock(ConfigReader::class);
21  $this->has_config_reader = new class($this->config_reader) {
22  use HasConfigReader;
23  public function __construct($cr)
24  {
25  $this->config_reader = $cr;
26  }
27 
28  public function _readAgentConfig(Agent $agent, InputInterface $input) : ?Config
29  {
30  return $this->readAgentConfig($agent, $input);
31  }
32  };
33  }
34 
36  {
37  $agent = $this->createMock(Agent::class);
38  $ii = $this->createMock(InputInterface::class);
39 
40  $agent
41  ->method("hasConfig")
42  ->willReturn(false)
43  ;
44 
45  $this->assertNull($this->has_config_reader->_readAgentConfig($agent, $ii));
46  }
47 }
A agent is some component that performs part of the setup process.
Definition: Agent.php:13
readAgentConfig(Agent $agent, InputInterface $input)
A configuration for the setup.
Definition: Config.php:10
__construct($a_client_id=0)
Constructor setup ILIAS global object public.
trait HasConfigReader
Add this to an Command that has an config reader.