/usr/share/php/tests/Horde_Alarm/Horde/Alarm/NullTest.php is in php-horde-alarm 2.0.5-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | <?php
/**
* @author Jan Schneider <jan@horde.org>
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @category Horde
* @package Alarm
* @subpackage UnitTests
*/
class Horde_Alarm_NullTest extends PHPUnit_Framework_TestCase
{
protected static $alarm;
protected static $date;
protected static $end;
public function testFactory()
{
self::$alarm = new Horde_Alarm_Null();
}
/**
* @depends testFactory
*/
public function testSet()
{
$now = time();
self::$date = new Horde_Date($now);
self::$end = new Horde_Date($now + 3600);
$hash = array('id' => 'personalalarm',
'user' => 'john',
'start' => self::$date,
'end' => self::$end,
'methods' => array(),
'params' => array(),
'title' => 'This is a personal alarm.');
self::$alarm->set($hash);
}
/**
* @depends testFactory
*/
public function testExists()
{
$this->assertFalse(self::$alarm->exists('personalalarm', 'john'));
}
/**
* @depends testFactory
* @expectedException Horde_Alarm_Exception
*/
public function testGet()
{
$alarm = self::$alarm->get('personalalarm', 'john');
}
/**
* @depends testFactory
*/
public function testListAlarms()
{
self::$alarm->set(array('id' => 'publicalarm',
'start' => self::$date,
'end' => self::$end,
'methods' => array(),
'params' => array(),
'title' => 'This is a public alarm.'));
self::$date->min--;
$list = self::$alarm->listAlarms('john');
$this->assertEquals(0, count($list));
}
/**
* @depends testFactory
*/
public function testDelete()
{
self::$alarm->delete('publicalarm', '');
$list = self::$alarm->listAlarms('john');
$this->assertEquals(0, count($list));
}
/**
* @depends testFactory
* @expectedException Horde_Alarm_Exception
*/
public function testSnoozeException()
{
self::$alarm->snooze('personalalarm', 'jane', 30);
}
/**
* @depends testFactory
*/
public function testSnooze()
{
$this->assertFalse(self::$alarm->isSnoozed('personalalarm', 'john'));
}
/**
* @depends testFactory
*/
public function testAlarmWithoutEnd()
{
self::$alarm->set(array('id' => 'noend',
'user' => 'john',
'start' => self::$date,
'methods' => array('notify'),
'params' => array(),
'title' => 'This is an alarm without end.'));
$list = self::$alarm->listAlarms('john', self::$end);
$this->assertEquals(0, count($list));
}
/**
* @depends testFactory
*/
public function testCleanUp()
{
self::$alarm->delete('noend', 'john');
self::$alarm->delete('personalalarm', 'john');
}
}
|