Move timetable to a plugin

Plugin repository: https://github.com/kanboard/plugin-timetable
This commit is contained in:
Frederic Guillot
2015-09-20 18:24:15 -04:00
parent 2021dccc5a
commit e6f547abcf
59 changed files with 137 additions and 2468 deletions

View File

@@ -17,6 +17,16 @@ class HookTest extends Base
$this->assertEquals(array('A', 'B'), $h->getListeners('myhook'));
}
public function testExists()
{
$h = new Hook;
$this->assertFalse($h->exists('myhook'));
$h->on('myhook', 'A');
$this->assertTrue($h->exists('myhook'));
}
public function testMergeWithNoBinding()
{
$h = new Hook;
@@ -59,4 +69,28 @@ class HookTest extends Base
$this->assertEquals($expected, $result);
$this->assertEquals($expected, $values);
}
public function testFirstWithNoBinding()
{
$h = new Hook;
$result = $h->first('myhook', array('p' => 2));
$this->assertEquals(null, $result);
}
public function testFirstWithMultipleBindings()
{
$h = new Hook;
$h->on('myhook', function($p) {
return $p + 1;
});
$h->on('myhook', function($p) {
return $p;
});
$result = $h->first('myhook', array('p' => 3));
$this->assertEquals(4, $result);
}
}