Initial unit test configuration
This commit is contained in:
parent
9e5cfe0d39
commit
0f107dbad3
40 changed files with 4301 additions and 303 deletions
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
error_reporting(E_ALL | E_STRICT);
|
||||
|
||||
// Define path to application directory
|
||||
defined('APPLICATION_PATH')
|
||||
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../../application'));
|
||||
|
||||
// Define application environment
|
||||
defined('APPLICATION_ENV')
|
||||
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'testing'));
|
||||
|
||||
// Ensure library/ is on include_path
|
||||
set_include_path(implode(PATH_SEPARATOR, array(
|
||||
realpath('./library'),
|
||||
get_include_path(),
|
||||
)));
|
||||
|
||||
require_once 'Zend/Application.php';
|
||||
#require_once 'DatabaseTestCase.php';
|
|
@ -1,20 +0,0 @@
|
|||
<?php
|
||||
|
||||
require_once 'PHPUnit/Framework/TestCase.php';
|
||||
|
||||
class ApiControllerTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
/* Setup Routine */
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
/* Tear Down Routine */
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
<?php
|
||||
|
||||
require_once 'PHPUnit/Framework/TestCase.php';
|
||||
|
||||
class DashboardControllerTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
/* Setup Routine */
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
/* Tear Down Routine */
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
<?php
|
||||
|
||||
require_once 'PHPUnit/Framework/TestCase.php';
|
||||
|
||||
class FormsControllerControllerTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
/* Setup Routine */
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
/* Tear Down Routine */
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
<?php
|
||||
|
||||
require_once 'PHPUnit/Framework/TestCase.php';
|
||||
|
||||
class LibraryControllerTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
/* Setup Routine */
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
/* Tear Down Routine */
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
<?php
|
||||
|
||||
require_once 'PHPUnit/Framework/TestCase.php';
|
||||
|
||||
class LoginControllerTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
/* Setup Routine */
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
/* Tear Down Routine */
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
<?php
|
||||
|
||||
require_once 'PHPUnit/Framework/TestCase.php';
|
||||
|
||||
class NowplayingControllerTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
/* Setup Routine */
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
/* Tear Down Routine */
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
<?php
|
||||
|
||||
require_once 'PHPUnit/Framework/TestCase.php';
|
||||
|
||||
class PlaylistControllerTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
/* Setup Routine */
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
/* Tear Down Routine */
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
<?php
|
||||
|
||||
require_once 'PHPUnit/Framework/TestCase.php';
|
||||
|
||||
class PluploadControllerTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
/* Setup Routine */
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
/* Tear Down Routine */
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
<?php
|
||||
|
||||
require_once 'PHPUnit/Framework/TestCase.php';
|
||||
|
||||
class PreferenceControllerTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
/* Setup Routine */
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
/* Tear Down Routine */
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
<?php
|
||||
|
||||
require_once 'PHPUnit/Framework/TestCase.php';
|
||||
|
||||
class RecorderControllerTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
/* Setup Routine */
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
/* Tear Down Routine */
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
<?php
|
||||
|
||||
require_once 'PHPUnit/Framework/TestCase.php';
|
||||
|
||||
class ScheduleControllerTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
/* Setup Routine */
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
/* Tear Down Routine */
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
<?php
|
||||
|
||||
require_once 'PHPUnit/Framework/TestCase.php';
|
||||
|
||||
class SearchControllerTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
/* Setup Routine */
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
/* Tear Down Routine */
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
<?php
|
||||
|
||||
require_once 'PHPUnit/Framework/TestCase.php';
|
||||
|
||||
class SidePlaylistControllerTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
/* Setup Routine */
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
/* Tear Down Routine */
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
<?php
|
||||
|
||||
require_once 'PHPUnit/Framework/TestCase.php';
|
||||
|
||||
class SideplaylistControllerTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
/* Setup Routine */
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
/* Tear Down Routine */
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
<?php
|
||||
|
||||
require_once 'PHPUnit/Framework/TestCase.php';
|
||||
|
||||
class UserControllerTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
/* Setup Routine */
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
/* Tear Down Routine */
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
76
airtime_mvc/tests/application/models/ShowTest.php
Normal file
76
airtime_mvc/tests/application/models/ShowTest.php
Normal file
|
@ -0,0 +1,76 @@
|
|||
<?php
|
||||
require_once "Zend/Test/PHPUnit/DatabaseTestCase.php";
|
||||
|
||||
class ShowTest extends Zend_Test_PHPUnit_DatabaseTestCase
|
||||
{
|
||||
private $_connectionMock;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->bootstrap = array($this, 'appBootstrap');
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
public function appBootstrap()
|
||||
{
|
||||
$this->application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH .'/configs/application.ini');
|
||||
$this->application->bootstrap();
|
||||
}
|
||||
|
||||
public function getConnection()
|
||||
{
|
||||
if ($this->_connectionMock == null) {
|
||||
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', 'production');
|
||||
$connection = Zend_Db::factory($config->db);
|
||||
|
||||
$this->_connectionMock = $this->createZendDbConnection(
|
||||
$connection,
|
||||
'airtimeunittests'
|
||||
);
|
||||
Zend_Db_Table_Abstract::setDefaultAdapter($connection);
|
||||
}
|
||||
return $this->_connectionMock;
|
||||
}
|
||||
|
||||
/* Defines how the initial state of the database should look before each test is executed
|
||||
* Called once during setUp() and gets recreated for each new test
|
||||
*/
|
||||
public function getDataSet()
|
||||
{
|
||||
return $this->createXmlDataSet(
|
||||
dirname(__FILE__) . '/files/cc_show_seed.xml'
|
||||
);
|
||||
}
|
||||
|
||||
public function testCcShowInsertedIntoDatabase()
|
||||
{
|
||||
$showService = new Application_Service_ShowService();
|
||||
|
||||
$data = array(
|
||||
"add_show_id" => -1,
|
||||
"add_show_name" => "test show",
|
||||
"add_show_description" => null,
|
||||
"add_show_url" => null,
|
||||
"add_show_genre" => null,
|
||||
"add_show_color" => "ffffff",
|
||||
"add_show_background_color" => "364492",
|
||||
"cb_airtime_auth" => 0,
|
||||
"cb_custom_auth" => 0,
|
||||
"custom_username" => null,
|
||||
"custom_password" => null,
|
||||
"add_show_linked" => 0
|
||||
);
|
||||
|
||||
$showService->setCcShow($data);
|
||||
|
||||
$ds = new Zend_Test_PHPUnit_Db_DataSet_QueryDataSet(
|
||||
$this->getConnection()
|
||||
);
|
||||
$ds->addTable('cc_show', 'select * from cc_show');
|
||||
|
||||
$this->assertDataSetsEqual(
|
||||
$this->createXmlDataSet(dirname(__FILE__)."/files/cc_show_insertIntoAssertion.xml"),
|
||||
$ds
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue