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
6
7use PHPUnit\Framework\TestCase;
8use Symfony\Component\Console\Input\InputInterface;
13
14class HasConfigReaderTest extends TestCase
15{
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) {
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}
An exception for terminatinating execution or to throw for unit testing.
Read a json-formatted config from a file and overwrite some fields.
__construct($a_client_id=0)
Constructor setup ILIAS global object @access public.
A agent is some component that performs part of the setup process.
Definition: Agent.php:14
A configuration for the setup.
Definition: Config.php:11
readAgentConfig(Agent $agent, InputInterface $input)
trait HasConfigReader
Add this to an Command that has an config reader.