ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilMailOptionsTest.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2017 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
10 {
14  public function testConstructor()
15  {
16  $userId = 1;
17 
18  $database = $this->getMockBuilder(ilDBInterface::class)
19  ->getMock();
20  $queryMock = $this->getMockBuilder(ilDBStatement::class)
21  ->getMock();
22 
23  $object = $this->getMockBuilder(stdClass::class)->getMock();
24  $object->cronjob_notification = false;
25  $object->signature = 'smth';
26  $object->linebreak = false;
27  $object->incoming_type = 0;
28  $object->mail_address_option = 0;
29  $object->email = 'test@test.com';
30  $object->second_email = 'ilias@ilias.com';
31 
32 
33  $database->expects($this->once())->method('fetchObject')->willReturn($object);
34  $database->expects($this->once())->method('queryF')->willReturn($queryMock);
35  $database->method('replace')->willReturn(0);
36 
37  $this->setGlobalVariable('ilDB', $database);
38 
39  $settings = $this->getMockBuilder(\ilSetting::class)->disableOriginalConstructor()->setMethods(array(
40  'set',
41  'get'
42  ))->getMock();
43  $this->setGlobalVariable('ilSetting', $settings);
44 
45  $mailOptions = new ilMailOptions($userId);
46  $this->assertEquals($object->signature, $mailOptions->getSignature());
47  $this->assertEquals($object->incoming_type, $mailOptions->getIncomingType());
48  $this->assertEquals($object->linebreak, $mailOptions->getLinebreak());
49  $this->assertEquals($object->cronjob_notification, $mailOptions->getCronjobNotification());
50  }
51 }
Class ilMailOptions this class handles user mails.
Class ilMailOptionsTest.
Class ilMailBaseTest.
once($eventName, callable $callBack, $priority=100)
Subscribe to an event exactly once.
setGlobalVariable($name, $value)