ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
BuildArtifactsCommandTest.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
6
8use Symfony\Component\Console\Tester\CommandTester;
9use ILIAS\Refinery\Factory as Refinery;
10use ILIAS\Data\Factory as DataFactory;
11
12class BuildArtifactsCommandTest extends \PHPUnit\Framework\TestCase
13{
14 public function testBasicFunctionality()
15 {
16 $refinery = new Refinery($this->createMock(DataFactory::class), $this->createMock(\ilLanguage::class));
17
18 $agent = $this->createMock(Setup\Agent::class);
19 $config_reader = $this->createMock(Setup\CLI\ConfigReader::class);
20 $command = new Setup\CLI\BuildArtifactsCommand(function () use ($agent) {
21 return $agent;
22 }, $config_reader, []);
23
24 $tester = new CommandTester($command);
25
26 $objective = $this->createMock(Setup\Objective::class);
27 $env = $this->createMock(Setup\Environment::class);
28
29 $agent
30 ->expects($this->once())
31 ->method("getBuildArtifactObjective")
32 ->with()
33 ->willReturn($objective);
34
35 $objective
36 ->expects($this->once())
37 ->method("getPreconditions")
38 ->willReturn([]);
39
40 $objective
41 ->expects($this->once())
42 ->method("achieve")
43 ->willReturn($env);
44
45 $tester->execute([
46 ]);
47 }
48}
An exception for terminatinating execution or to throw for unit testing.
Builds data types.
Definition: Factory.php:20