public function testHandlerInsertion()
{
$this->subject = new Simple(array('context' => array('content' => '', 'title' => '', 'scripts' => array(), 'styles' => array(), 'foo' => '!')));
$foo = function ($value) {
return "Foo: {$value}";
};
$expected = array('url', 'path', 'options', 'title', 'value', 'scripts', 'styles', 'head', 'foo');
$result = array_keys($this->subject->handlers(compact('foo')));
$this->assertEqual($expected, $result);
$result = $this->subject->applyHandler(null, null, 'foo', 'test value');
$this->assertEqual('Foo: test value', $result);
$this->assertEqual('Foo: !', $this->subject->foo());
$this->assertEqual($foo, $this->subject->handlers('foo'));
$this->assertNull($this->subject->handlers('bar'));
$bar = function ($value) {
return "Bar: {$value}";
};
$this->subject->handlers(compact('bar'));
$result = $this->subject->applyHandler(null, null, 'bar', 'test value');
$expected = 'Bar: test value';
$this->assertEqual($expected, $result);
$result = $this->subject->bar('test value');
$this->assertEqual($expected, $result);
}