ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
IlCertificateActiveActionTest.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
3
8{
9 public function testCertificateIsActive()
10 {
11 $databaseMock = $this->getMockBuilder('ilDBInterface')
12 ->getMock();
13
14 $databaseMock->expects($this->atLeastOnce())
15 ->method('query');
16
17 $databaseMock->expects($this->atLeastOnce())
18 ->method('fetchAssoc')
19 ->willReturn(array(1, 2, 3));
20
21 $activateAction = new ilCertificateActiveAction($databaseMock);
22 $result = $activateAction->isObjectActive(10);
23
24 $this->assertTrue($result);
25 }
26
28 {
29 $databaseMock = $this->getMockBuilder('ilDBInterface')
30 ->getMock();
31
32
33 $databaseMock->expects($this->atLeastOnce())
34 ->method('query');
35
36 $databaseMock->expects($this->atLeastOnce())
37 ->method('fetchAssoc')
38 ->willReturn(array());
39
40 $activateAction = new ilCertificateActiveAction($databaseMock);
41 $result = $activateAction->isObjectActive(10);
42
43 $this->assertFalse($result);
44 }
45}
$result
An exception for terminatinating execution or to throw for unit testing.
Class ilCertificateBaseTestCase.