ILIAS  release_7 Revision v7.30-3-g800a261c036
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 PHPUnit\Framework\TestCase;
9use Symfony\Component\Console\Tester\CommandTester;
10
11class BuildArtifactsCommandTest extends TestCase
12{
13 public function testBasicFunctionality() : void
14 {
15 $agent_finder = $this->createMock(Setup\AgentFinder::class);
16
17 $agent = $this->createMock(Setup\AgentCollection::class);
18 $agent_finder
19 ->expects($this->once())
20 ->method("getAgents")
21 ->with()
22 ->willReturn($agent);
23
24 $objective = $this->createMock(Setup\Objective::class);
25 $agent
26 ->expects($this->once())
27 ->method("getBuildArtifactObjective")
28 ->with()
29 ->willReturn($objective);
30
31 $objective
32 ->expects($this->once())
33 ->method("getPreconditions")
34 ->willReturn([]);
35
36 $objective
37 ->expects($this->once())
38 ->method("achieve")
39 ->will($this->returnCallback(function (Setup\Environment $e) {
40 return $e;
41 }));
42
43 $objective
44 ->expects($this->once())
45 ->method("isApplicable")
46 ->willReturn(true);
47
48 $command = new Setup\CLI\BuildArtifactsCommand($agent_finder);
49 $tester = new CommandTester($command);
50 $tester->execute([]);
51 }
52}
An exception for terminatinating execution or to throw for unit testing.
An environment holds resources to be used in the setup process.
Definition: Environment.php:12
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...