ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 
27  public function testCertificateIsNotActive()
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