mirror of
https://github.com/e107inc/e107.git
synced 2025-04-22 13:41:52 +02:00
Form tests for renderValue method. Basic test for db_mysql class.
This commit is contained in:
parent
3ddf17de3f
commit
8870a065b5
tests
@ -42,6 +42,11 @@ class UserSignupCest
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// "Admin Approval Pending"
|
||||
//TODO signup under difference conditions (different prefs).. ie. admin approval required etc.
|
||||
|
||||
}
|
||||
|
369
tests/unit/e_db_mysqlTest.php
Normal file
369
tests/unit/e_db_mysqlTest.php
Normal file
@ -0,0 +1,369 @@
|
||||
<?php
|
||||
/**
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2018 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
class e_db_mysqlTest extends \Codeception\Test\Unit
|
||||
{
|
||||
|
||||
/* public function testGetPDO()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testGetMode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testDb_Connect()
|
||||
{
|
||||
|
||||
}*/
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*/
|
||||
public function testConnect()
|
||||
{
|
||||
try
|
||||
{
|
||||
$class = $this->make('e_db_mysql');
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$this->assertTrue(false, "Couldn't load e_db_mysql object");
|
||||
}
|
||||
|
||||
if(is_object($class))
|
||||
{
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
}
|
||||
/*
|
||||
public function testGetServerInfo()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testDatabase()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testGetConfig()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testDb_Mark_Time()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testDb_Show_Performance()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testDb_Write_log()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testDb_Query()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testRetrieve()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testSelect()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testDb_Select()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testInsert()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testLastInsertId()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testFoundRows()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testRowCount()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testDb_Insert()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testReplace()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testDb_Replace()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testUpdate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testDb_Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function test_getTypes()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function test_getFieldValue()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testDb_UpdateArray()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testTruncate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testFetch()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testDb_Fetch()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testCount()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testDb_Count()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testClose()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testDb_Close()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testDelete()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testDb_Delete()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testDb_Rows()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testDb_SetErrorReporting()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testGen()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testDb_Select_gen()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testMl_check()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testDb_IsLang()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testDb_getList()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testRows()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testMax()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testSelectTree()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testDb_QueryCount()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testDb_Query_all()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testDb_FieldList()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testDb_Field()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testColumnCount()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testField()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testEscape()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testDb_Table_exists()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testIsTable()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testIsEmpty()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testDb_ResetTableList()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testDb_TableList()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testTables()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testDb_CopyRow()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testDb_CopyTable()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testBackup()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testDbError()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testGetLastErrorNumber()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testGetLastErrorText()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testResetLastError()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testGetLastQuery()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testDb_Set_Charset()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testGetFieldDefs()
|
||||
{
|
||||
|
||||
}*/
|
||||
}
|
585
tests/unit/e_formTest.php
Normal file
585
tests/unit/e_formTest.php
Normal file
@ -0,0 +1,585 @@
|
||||
<?php
|
||||
/**
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2018 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
class e_formTest extends \Codeception\Test\Unit
|
||||
{
|
||||
protected $_frm;
|
||||
|
||||
protected $_id = 567; // simulated record number.
|
||||
|
||||
|
||||
// admin_ui $fields format..
|
||||
protected $_fields = array(
|
||||
|
||||
'text_001' => array('title'=> "Text 001", 'type' => 'text', 'writeParms'=>array('size'=>'xlarge')),
|
||||
|
||||
// 'text_002' etc.. add other configurations with type='text' in here.
|
||||
|
||||
'number_001' => array('title'=> "Number 001", 'type' => 'number', 'writeParms'=>array('min'=>0)),
|
||||
'number_002' => array('title'=> "Number 002", 'type' => 'number', 'inline'=>true, 'writeParms'=>array('min'=>0)),
|
||||
|
||||
'bool_001' => array('title'=> "Bool 001", 'type' => 'text', 'writeParms'=>array('size'=>'xlarge')),
|
||||
'bool_002' => array('title'=> "Bool 002", 'type' => 'text', 'inline'=>true, 'writeParms'=>array('size'=>'xlarge')),
|
||||
|
||||
'dropdown_001' => array('title'=>'Dropdown 001', 'type'=>'dropdown', 'tab'=>1, 'writeParms' => array('optArray'=>array('opt_value_1'=>'Label 1', 'opt_value_2'=>'Label 2')) ),
|
||||
|
||||
|
||||
'textarea_001' => array('title'=> "Textarea 001", 'type' => 'textarea', 'writeParms'=>array('size'=>'xlarge','rows'=> 5)),
|
||||
|
||||
'layout_001' => array ( 'title' => 'Layouts 001', 'type' => 'layouts', 'inline' => false, 'writeParms' => 'plugin=news&id=news_view&merge=1' ), // 'news', 'news_view', 'front'
|
||||
'layout_002' => array ( 'title' => 'Layouts 002', 'type' => 'layouts', 'inline' => true, 'writeParms'=>array('plugin'=>'news', 'id'=>'news_view', 'area'=> 'front', 'merge'=>false)), // 'news', 'news_view', 'front'
|
||||
// 'layout_003' => array ( 'title' => 'Layouts 003', 'type' => 'layouts', 'inline' => true, 'writeParms'=>array('plugin'=>'news', 'id'=>'news_view', 'area'=> 'front', 'merge'=>false)), // 'news', 'news_view', 'front'
|
||||
|
||||
);
|
||||
|
||||
// simulated database/form values.
|
||||
protected $_values = array(
|
||||
'text_001' => 'some text',
|
||||
|
||||
'number_001' => 555,
|
||||
'number_002' => 444,
|
||||
|
||||
'bool_001' => 1,
|
||||
'bool_002' => 1,
|
||||
|
||||
'dropdown_001' => 'opt_value_2',
|
||||
|
||||
'textarea_001' => "the quick brown fox jumps over the lazy dog",
|
||||
|
||||
'layout_001' => 'default',
|
||||
'layout_002' => 'default'
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
protected function _before()
|
||||
{
|
||||
try
|
||||
{
|
||||
$this->_frm = $this->make('e_form');
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$this->assertTrue(false, "Couldn't load e_parser object");
|
||||
}
|
||||
}
|
||||
|
||||
protected function _after()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* public function testAddWarning()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testOpen()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testClose()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testCountry()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testGetCountry()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testGetRequiredString()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testSetRequiredString()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testTags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testTabs()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testCarousel()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testUrl()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testText()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testNumber()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testEmail()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testIconpreview()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testIconpicker()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testAvatarpicker()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testImagepicker()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testFilepicker()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testDatepicker()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testUserlist()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testUserpicker()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testRate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testLike()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testFile()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testUpload()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testPassword()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testPagination()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testProgressBar()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testTextarea()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testBbarea()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testCheckbox()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testCheckboxes()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testCheckbox_label()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testCheckbox_switch()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testCheckbox_toggle()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testUc_checkbox()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function test_uc_checkbox_cb()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testUc_label()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testRadio()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testRadio_switch()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testFlipswitch()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testLabel()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testHelp()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testSelect_open()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testSelectbox()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testSelect()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testUserclass()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testSearch()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testUc_select()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function test_uc_select_cb()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testOptgroup_open()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testOption()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testOption_multi()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testOptgroup_close()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testSelect_close()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testHidden()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testToken()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testSubmit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testSubmit_image()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testAdmin_trigger()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testButton()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testBreadcrumb()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testInstantEditButton()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testAdmin_button()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testDefaultButtonClassExists()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testGetDefaultButtonClassByAction()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testGetNext()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testGetCurrent()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testResetTabindex()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testGet_attributes()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function test_format_id()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testName2id()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testFormat_options()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function test_default_options()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testColumnSelector()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testColGroup()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testThead()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testRenderHooks()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testRenderRelated()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testRenderTableRow()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testRenderInline()
|
||||
{
|
||||
|
||||
}
|
||||
*/
|
||||
public function testRenderValue()
|
||||
{
|
||||
|
||||
$frm = $this->_frm;
|
||||
|
||||
$expected = array(
|
||||
'text_001' => 'some text',
|
||||
|
||||
'number_001' => 555,
|
||||
'number_002' => "<a class='e-tip e-editable editable-click' data-name='number_002' title=\"Edit Number 002\" data-type='text' data-pk='0' data-url='".e_SELF."?mode=&action=inline&id=0&ajax_used=1' href='#'>444</a>",
|
||||
|
||||
'bool_001' => 1,
|
||||
'bool_002' => "<a class='e-tip e-editable editable-click' data-emptytext='-' data-name='bool_002' title=\"Edit Bool 002\" data-type='text' data-pk='0' data-url='".e_SELF."?mode=&action=inline&id=0&ajax_used=1' href='#'>1</a>",
|
||||
|
||||
'dropdown_001' => 'Label 2',
|
||||
|
||||
'textarea_001' => "the quick brown fox jumps over the lazy dog",
|
||||
|
||||
'layout_001' => 'default',
|
||||
'layout_002' => "<a class='e-tip e-editable editable-click ' data-name='layout_002' data-source='{\"default\":\"Default\",\"videos\":\"Videos (experimental)\"}' title=\"Edit Layouts 002\" data-type='select' data-inputclass='x-editable-layout-002 ' data-value=\"default\" href='#' data-url='".e_SELF."?mode=&action=inline&id=0&ajax_used=1'>Default</a>"
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
foreach($this->_fields as $field=>$att)
|
||||
{
|
||||
$value = $this->_values[$field];
|
||||
$result = $frm->renderValue($field, $value, $att);
|
||||
|
||||
if(!isset($expected[$field]))
|
||||
{
|
||||
$this->expectExceptionMessage('\$expected value for \$field not set in script');
|
||||
}
|
||||
|
||||
$this->assertEquals($expected[$field], $result);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function testRenderElement()
|
||||
{
|
||||
|
||||
}
|
||||
/*
|
||||
public function testRenderListForm()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testRenderGridForm()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testRenderCreateForm()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testRenderCreateFieldset()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testRenderCreateButtonsBar()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testRenderForm()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testRenderFieldset()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testRenderValueTrigger()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testRenderElementTrigger()
|
||||
{
|
||||
|
||||
}*/
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user