ILIAS  release_8 Revision v8.23
HasConfigReaderTest.php
Go to the documentation of this file.
1 <?php
2 
19 namespace ILIAS\Tests\Setup\CLI;
20 
27 
28 class HasConfigReaderTest extends TestCase
29 {
30  protected $has_config_reader;
31 
32  public function setUp(): void
33  {
34  $this->config_reader = $this->createMock(ConfigReader::class);
35  $this->has_config_reader = new class ($this->config_reader) {
36  use HasConfigReader;
37  public function __construct($cr)
38  {
39  $this->config_reader = $cr;
40  }
41 
42  public function _readAgentConfig(Agent $agent, InputInterface $input, string $use_config_field = null): ?Config
43  {
44  return $this->readAgentConfig($agent, $input, $use_config_field);
45  }
46  };
47  }
48 
50  {
51  $agent = $this->createMock(Agent::class);
52  $ii = $this->createMock(InputInterface::class);
53 
54  $agent
55  ->method("hasConfig")
56  ->willReturn(false)
57  ;
58 
59  $this->assertNull($this->has_config_reader->_readAgentConfig($agent, $ii));
60  }
61 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
A agent is some component that performs part of the setup process.
Definition: Agent.php:29
__construct()
Constructor setup ILIAS global object public.
Definition: class.ilias.php:62
readAgentConfig(Agent $agent, InputInterface $input, string $use_config_field=null)
A configuration for the setup.
Definition: Config.php:26
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
trait HasConfigReader
Add this to an Command that has an config reader.