Restructuring unit/integration tests
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
<?php
|
||||
include dirname(__FILE__).'/test.includes.php';
|
||||
|
||||
class TestTemplate extends PHPUnit_Framework_TestCase{
|
||||
|
||||
protected $usersArray = array();
|
||||
|
||||
@@ -3,6 +3,7 @@ if(file_exists('/usr/lib/php5/mysql.auth.php')){
|
||||
include '/usr/lib/php5/mysql.auth.php';
|
||||
}
|
||||
include(dirname(__FILE__).'/test.config.php');
|
||||
include(dirname(__FILE__).'/test.includes.php');
|
||||
|
||||
|
||||
$dropDBCommand = 'echo "DROP DATABASE IF EXISTS ' . APP_DB . '"| mysql -u' . MYSQL_ROOT_USER . ' -p' . MYSQL_ROOT_PASS;
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
<?php
|
||||
if(!class_exists("TestTemplate")) {
|
||||
include dirname(__FILE__).'/../TestTemplate.php';
|
||||
}
|
||||
|
||||
class LanguageManagerTest extends TestTemplate{
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function testTran(){
|
||||
$this->assertEquals('cat', \Classes\LanguageManager::tran('cat'));
|
||||
$this->assertEquals('solid', \Classes\LanguageManager::tran('solid'));
|
||||
$this->assertEquals('one file', \Classes\LanguageManager::tran('one file'));
|
||||
$this->assertEquals('2 files', \Classes\LanguageManager::tran('2 files'));
|
||||
$this->assertEquals('User Logged In now', \Classes\LanguageManager::translateTnrText('User <t>Logged In</t> now'));
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,19 @@
|
||||
<?php
|
||||
namespace Test\Integration;
|
||||
|
||||
if(!class_exists("TestTemplate")) {
|
||||
include dirname(__FILE__).'/../TestTemplate.php';
|
||||
}
|
||||
use Classes\Approval\ApprovalStatus;
|
||||
use Employees\Common\Model\Employee;
|
||||
use Travel\Common\Model\EmployeeTravelRecord;
|
||||
|
||||
|
||||
class ApprovalStatusTest extends TestTemplate{
|
||||
class ApprovalStatusIntegration extends \TestTemplate{
|
||||
|
||||
var $travelRec = null;
|
||||
|
||||
protected function setUp(){
|
||||
|
||||
parent::setUp();
|
||||
$emp = new \Employees\Common\Model\Employee();
|
||||
$emp = new Employee();
|
||||
$emp->Load("id = ?",array(1));
|
||||
$emp->supervisor = 2;
|
||||
$emp->indirect_supervisors = json_encode(array(3,4));
|
||||
@@ -23,7 +24,7 @@ class ApprovalStatusTest extends TestTemplate{
|
||||
|
||||
|
||||
|
||||
$this->travelRec = new \Travel\Common\Model\EmployeeTravelRecord();
|
||||
$this->travelRec = new EmployeeTravelRecord();
|
||||
|
||||
$this->travelRec->DB()->execute("delete from EmployeeTravelRecords");
|
||||
|
||||
@@ -46,7 +47,7 @@ class ApprovalStatusTest extends TestTemplate{
|
||||
public function testInitializeApprovalChain(){
|
||||
$id = $this->travelRec->id;
|
||||
//$this->initializeObjects();
|
||||
$as = \Classes\Approval\ApprovalStatus::getInstance();
|
||||
$as = ApprovalStatus::getInstance();
|
||||
$as->initializeApprovalChain('EmployeeTravelRecord',$id);
|
||||
$status = $as->getAllStatuses('EmployeeTravelRecord',$id);
|
||||
$this->assertEquals(3, count($status));
|
||||
@@ -56,7 +57,7 @@ class ApprovalStatusTest extends TestTemplate{
|
||||
public function testUpdateApprovalStatus(){
|
||||
$id = $this->travelRec->id;
|
||||
//$this->initializeObjects();
|
||||
$as = \Classes\Approval\ApprovalStatus::getInstance();
|
||||
$as = ApprovalStatus::getInstance();
|
||||
|
||||
$as->initializeApprovalChain('EmployeeTravelRecord',$id);
|
||||
$resp = $as->updateApprovalStatus('EmployeeTravelRecord',$id,2,1);
|
||||
@@ -7,9 +7,9 @@ if(!defined('TEST_BASE_PATH')){
|
||||
//Mock Session class
|
||||
if (!class_exists('SessionUtils')) {
|
||||
class SessionUtils{
|
||||
|
||||
|
||||
public static $data;
|
||||
|
||||
|
||||
public static function getSessionObject($name){
|
||||
if(empty(self::$data)){
|
||||
self::$data = array();
|
||||
@@ -33,5 +33,8 @@ if (!class_exists('SessionUtils')) {
|
||||
|
||||
|
||||
}
|
||||
if (!class_exists('TestTemplate')) {
|
||||
include(dirname(__FILE__).'/TestTemplate.php');
|
||||
include(APP_BASE_PATH."/includes.inc.php");
|
||||
}
|
||||
|
||||
include(APP_BASE_PATH."/includes.inc.php");
|
||||
|
||||
22
test/unit/LanguageManagerUnit.php
Normal file
22
test/unit/LanguageManagerUnit.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
namespace Test\Unit;
|
||||
|
||||
use Classes\LanguageManager;
|
||||
|
||||
class LanguageManagerUnit extends \TestTemplate{
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
}
|
||||
|
||||
public function testTran(){
|
||||
$this->assertEquals('cat', LanguageManager::tran('cat'));
|
||||
$this->assertEquals('solid', LanguageManager::tran('solid'));
|
||||
$this->assertEquals('one file', LanguageManager::tran('one file'));
|
||||
$this->assertEquals('2 files', LanguageManager::tran('2 files'));
|
||||
$this->assertEquals('User Logged In now', LanguageManager::translateTnrText('User <t>Logged In</t> now'));
|
||||
fwrite(STDOUT, __METHOD__ . " End\n");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user