Permalink
Browse files

Add basic handler tests

  • Loading branch information...
flack committed Jul 16, 2017
1 parent c723755 commit c49531c665c808765727d029a5fd9f8108d2e21b
@@ -0,0 +1,60 @@
<?php
/**
* @package openpsa.test
* @author CONTENT CONTROL http://www.contentcontrol-berlin.de/
* @copyright CONTENT CONTROL http://www.contentcontrol-berlin.de/
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License
*/
/**
* OpenPSA testcase
*
* @package openpsa.test
*/
class midcom_helper_imagepopup_handler_linksTest extends openpsa_testcase
{
public function testHandler_open()
{
midcom::get()->auth->request_sudo('midcom.helper.imagepopup');
$node = self::get_component_node('net.nehmer.static');
$url = $this->run_relocate_handler('net.nehmer.static', ['__ais', 'imagepopup', 'open', 'file', $node->guid]);
$this->assertEquals('__ais/imagepopup/links/file/' . $node->guid . '/', $url);
midcom::get()->auth->drop_sudo();
}
public function testHandler_open_noobject()
{
midcom::get()->auth->request_sudo('midcom.helper.imagepopup');
$url = $this->run_relocate_handler('net.nehmer.static', ['__ais', 'imagepopup', 'open', 'dummy']);
$this->assertEquals('__ais/imagepopup/folder/dummy/', $url);
midcom::get()->auth->drop_sudo();
}
public function testHandler_links()
{
midcom::get()->auth->request_sudo('midcom.helper.imagepopup');
$this->create_user(true);
$node = self::get_component_node('net.nehmer.static');
$data = $this->run_handler('net.nehmer.static', ['__ais', 'imagepopup', 'links', 'file', $node->guid]);
$this->assertEquals('____ais-imagepopup-list_links', $data['handler_id']);
$this->show_handler($data);
midcom::get()->auth->drop_sudo();
}
public function testHandler_links_noobject()
{
midcom::get()->auth->request_sudo('midcom.helper.imagepopup');
$this->create_user(true);
$data = $this->run_handler('net.nehmer.static', ['__ais', 'imagepopup', 'links', 'dummy']);
$this->assertEquals('____ais-imagepopup-list_links_noobject', $data['handler_id']);
midcom::get()->auth->drop_sudo();
}
}
@@ -0,0 +1,63 @@
<?php
/**
* @package openpsa.test
* @author CONTENT CONTROL http://www.contentcontrol-berlin.de/
* @copyright CONTENT CONTROL http://www.contentcontrol-berlin.de/
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License
*/
/**
* OpenPSA testcase
*
* @package openpsa.test
*/
class midcom_helper_imagepopup_handler_listTest extends openpsa_testcase
{
public function testHandler_list_folder()
{
midcom::get()->auth->request_sudo('midcom.helper.imagepopup');
$this->create_user(true);
$node = self::get_component_node('net.nehmer.static');
$data = $this->run_handler('net.nehmer.static', ['__ais', 'imagepopup', 'folder', 'file', $node->guid]);
$this->assertEquals('____ais-imagepopup-list_folder', $data['handler_id']);
$this->show_handler($data);
midcom::get()->auth->drop_sudo();
}
public function testHandler_list_folder_noobject()
{
midcom::get()->auth->request_sudo('midcom.helper.imagepopup');
$this->create_user(true);
$data = $this->run_handler('net.nehmer.static', ['__ais', 'imagepopup', 'folder', 'file']);
$this->assertEquals('____ais-imagepopup-list_folder_noobject', $data['handler_id']);
midcom::get()->auth->drop_sudo();
}
public function testHandler_list_unified()
{
midcom::get()->auth->request_sudo('midcom.helper.imagepopup');
$this->create_user(true);
$node = self::get_component_node('net.nehmer.static');
$data = $this->run_handler('net.nehmer.static', ['__ais', 'imagepopup', 'unified', 'file', $node->guid]);
$this->assertEquals('____ais-imagepopup-list_unified', $data['handler_id']);
$this->show_handler($data);
midcom::get()->auth->drop_sudo();
}
public function testHandler_list_unified_noobject()
{
midcom::get()->auth->request_sudo('midcom.helper.imagepopup');
$this->create_user(true);
$data = $this->run_handler('net.nehmer.static', ['__ais', 'imagepopup', 'unified', 'file']);
$this->assertEquals('____ais-imagepopup-list_unified_noobject', $data['handler_id']);
midcom::get()->auth->drop_sudo();
}
}

0 comments on commit c49531c

Please sign in to comment.