W.I.P. Some more Etemplate testing stuff

This commit is contained in:
nathangray 2017-04-06 11:11:58 -06:00
parent 25b4c534a4
commit ee62801ace
3 changed files with 132 additions and 0 deletions

View File

@ -0,0 +1,31 @@
<?php
/**
* App
*
* @link http://www.egroupware.org
* @author Nathan Gray
* @package
* @copyright (c) 2017 Nathan Gray
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
*/
namespace EGroupware\Api\Etemplate\Widget;
/**
* Description of TemplateTest
*
* @author nathan
*/
class TemplateTest extends WidgetBaseTest {
/**
* Test instanciation of a template
*/
public function testInstance()
{
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
}

View File

@ -0,0 +1,26 @@
<?php
/**
* Base test file for all widget tests
*
* @link http://www.egroupware.org
* @author Nathan Gray
* @package api
* @copyright (c) 2017 Nathan Gray
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
*/
namespace EGroupware\Api\Etemplate;
// test base providing Egw environment, since we need the DB
require_once realpath(__DIR__.'/../../test/LoggedInTest.php');
/**
* Base class for all widget tests
*
* Widget scans the apps for widgets, which needs the app list, pulled from the
* database, so we need to log in.
*/
class WidgetBaseTest extends \EGroupware\Api\LoggedInTest {
//put your code here
}

View File

@ -0,0 +1,75 @@
<?php
/**
* Test Etemplate main file
*
* @link http://www.egroupware.org
* @author Nathan Gray
* @package api
* @copyright (c) 2017 Nathan Gray
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
*/
namespace EGroupware\Api;
use EGroupware\Api;
use PHPUnit_Framework_TestCase as TestCase;
/**
* Test the main class of Etemplate
*
* Etemplate Widget base classscans the apps for widgets, which needs the app
* list, pulled from the database, so we need to log in.
*/
class EtemplateTest extends \EGroupware\Api\LoggedInTest {
/**
* Test reading xml files
*
* This really just tests that the files can be found. Testing the parsing
* is done in the Template test.
*/
public function testRead()
{
$etemplate = new Etemplate();
// Test missing template fails
$this->assertEquals(false, $etemplate->read('totally invalid'), 'Reading invalid template');
// Templates must be in the correct templates directory - use one from API
$this->assertEquals(true, $etemplate->read('api.prompt'));
}
public function testSetDOMId()
{
$etemplate = new Etemplate();
/*
Etemplate::$response = $this->getMockBuilder(Etemplate\Api\Json\Response)
->disableOriginalConstructor()
->setMethods(['generic'])
->getMock($etemplate);
Etemplate::$response->expects($this->once())
->method('generic');
*/
$etemplate->set_dom_id('test_id');
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
public function testArrayMerge()
{
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
public function testExec()
{
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
}