9use PHPUnit\Framework\TestCase;
31 ->getMockBuilder(
Artifact\BuildArtifactObjective::class)
32 ->setMethods([
"build",
"buildIn",
"getArtifactPath"])
35 $this->artifact = $this->createMock(Setup\Artifact::class);
36 $this->env = $this->createMock(Setup\Environment::class);
42 ->getMockBuilder(
Artifact\BuildArtifactObjective::class)
43 ->setMethods([
"build",
"getArtifactPath"])
47 ->expects($this->once())
50 ->willReturn($this->artifact);
52 $this->assertSame($this->artifact, $this->o->buildIn($this->env));
57 $this->assertEquals([], $this->o->getPreconditions($this->env));
62 $path =
"path/to/artifact";
65 ->expects($this->once())
66 ->method(
"getArtifactPath")
70 $this->assertIsString($this->o->getHash());
75 $path =
"path/to/artifact";
78 ->expects($this->once())
79 ->method(
"getArtifactPath")
83 $this->assertEquals(
"Build $path", $this->o->getLabel());
88 $this->assertTrue($this->o->isNotable());
91 const TEST_PATH =
"BuildArtifactObjectiveTest_testAchive";
97 ->expects($this->atLeastOnce())
98 ->method(
"getArtifactPath")
103 ->expects($this->once())
106 ->willReturn($this->artifact);
110 ->expects($this->once())
111 ->method(
"serialize")
115 $this->o->achieve($this->env);
117 $this->assertEquals(
$artifact, file_get_contents($path));
122 if (file_exists(getcwd() .
"/" . self::TEST_PATH)) {
123 unlink(getcwd() .
"/" . self::TEST_PATH);
An exception for terminatinating execution or to throw for unit testing.
testBuildInDefaultsToBuild()
An artifact is some file that is build on demand per installation and is not shipped with the ILIAS s...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...