Skip to content

Commit

Permalink
testsite fixes, and php warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
weyrick committed Nov 17, 2009
1 parent a881d15 commit d4a23d0
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 44 deletions.
2 changes: 1 addition & 1 deletion contrib/modules/ngMenu.mod
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ class ngMenu extends SM_module {
}

/** configure the menu module, and also the root item */
function addDirective($key, $val) {
function addDirective($key, $val='', $overWrite=true) {
parent::addDirective($key, $val);
$this->rootItem->addDirective($key, $val);
}
Expand Down
8 changes: 6 additions & 2 deletions lib/sfFormEntity.inc
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,18 @@ class SM_formEntity extends SM_object {
* @param mixed $val initial value
* @param string fieldset
*/
function SM_formEntity($vn, $tt, $ty, $req, $parentSmartForm, $tpt, $val='', $fieldset='') {
function SM_formEntity($vn, $tt, $ty, $req, $parentSmartForm, $tpt='', $val='', $fieldset='') {

// setup handlers
$this->_smoConfigure();

// parent smartForm
$this->parentSmartForm = $parentSmartForm;

// default template
if (empty($tpt))
$tpt = $parentSmartForm->formEntityTpt;

// configure self
$this->configure($this->parentSmartForm->directive);

Expand Down Expand Up @@ -151,7 +155,7 @@ class SM_formEntity extends SM_object {
}

// setup default class tag for the entities use
$newEntity->addDirective('entityClassTag',$this->directive['entityClassTag']);
$newEntity->addDirective('entityClassTag', $this->getDirective('entityClassTag'));

// if this entity is required input, automatically add a requiredFilter
if ($req) {
Expand Down
2 changes: 1 addition & 1 deletion lib/sfInputEntities.inc
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ class SM_inputTypeEntity extends SM_object {
// create the filter and add it to this entity
$filterClass = $fType.'Filter';
$newFilter = new $filterClass($this);
$newFilter->setInfo($varName, $msg, $this->useJS);
$newFilter->setInfo($varName, $msg);

// save to this entity
$this->filterList[$fType] = $newFilter;
Expand Down
4 changes: 3 additions & 1 deletion lib/sfInputEntities/submitEntity.inc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class submitEntity extends SM_inputTypeEntity {
function entityConfig() {

// clean layout up, we'll do our own
$this->parentFormEntity->layout = SF_LAYOUT_SINGLENOBR;
//$this->parentFormEntity->layout = SF_LAYOUT_SINGLENOBR;

// SUBMIT or IMG
$this->directive['image'] = false;
Expand All @@ -70,9 +70,11 @@ class submitEntity extends SM_inputTypeEntity {
else
$sType = 'submit';

$class = '';
if ($this->directive['class'])
$class = '<span class="'.$this->directive['class'].'">';

$eclass = '';
if ($this->directive['class'])
$eclass = '</span>';

Expand Down
6 changes: 4 additions & 2 deletions lib/smTags/AREA_tag.inc
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,14 @@ class SM_smTag_AREA extends SM_smTag {
$this->debugLog("object appeared to be: ".get_class($this->itemList[$key]));
}

}

}

$class = '';
if (isset($this->attributes['CLASS'])) {
$class = ' class="'.$this->attributes['CLASS'].'"';
}

$id = '';
if (isset($this->attributes['ID'])) {
$id = ' id="'.$this->attributes['ID'].'"';
}
Expand Down
1 change: 0 additions & 1 deletion testSite/admin/codePlates/testCodePlate.cpt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class testCodePlate extends SM_codePlate {
*/
function codePlateThink() {

// create a new module. notice, returns a reference!!
$mod1 = $this->loadModule('rawHTML','areaOne');

// configure the module
Expand Down
5 changes: 3 additions & 2 deletions testSite/admin/modules/test_modules.mod
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class test_modules extends testBase {
}


function eventBadInVar($var) {
function eventBadInVar($var='', $wantedType='') {

$actual = $var;
$expect = 'modVar2';
Expand Down Expand Up @@ -131,7 +131,7 @@ class test_modules extends testBase {
// load module
$mod = $this->loadModule('rawHTML');
$mod->addDirective('output','fufu');
$mod->addDirective('cleanOutput',true);
$mod->addDirective('outputWrapper',SM_module::WRAP_NONE);
$actual = $mod->run();
$expect = 'fufu';
$this->addTest('loadModule',
Expand All @@ -147,6 +147,7 @@ class test_modules extends testBase {
moo
<br>
Template Test Complete
';
$this->addTest('loadTemplate',
'load template for use in this module',
Expand Down
2 changes: 1 addition & 1 deletion testSite/admin/modules/test_smObjects.mod
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class test_smObjects extends testBase {
$this->debugLog("test debuglog entry",5);
$testEntry = array_pop($SM_debugOutput);
$actual = $testEntry;
$expect = array('msg' => 'test_smObjects:: test debuglog entry', 'verbosity' => 5);
$expect = array('msg' => '<span class="caller">test_smObjects::</span> test debuglog entry', 'verbosity' => 5);
$this->addTest('debugLog() method',
'make sure debugLog() method writes to global debugLog',
$expect,
Expand Down
12 changes: 5 additions & 7 deletions testSite/admin/modules/test_smRoot.mod
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class test_smRoot extends testBase {
(sample text added to area)
<br>
Template Test Complete
';
$this->addTest('loadTemplate()',
'Load, parse and run template from file through SM_siteManager root object',
Expand All @@ -93,7 +94,7 @@ Template Test Complete

// load module
$mod = $SM_siteManager->loadModule('rawHTML');
$mod->addDirective('cleanOutput', true);
$mod->addDirective('outputWrapper', SM_module::WRAP_NONE);
$mod->addDirective('output','sample module output');
$actual = $mod->run();
$expect = 'sample module output';
Expand Down Expand Up @@ -124,15 +125,12 @@ Template Test Complete
$cpt->addText('<b>Codeplate Test</b><br>', 'areaOne');
$actual = $cpt->run();
$expect = '<b>Sample Template</b><br>
<b>Codeplate Test</b><br><span id="SM5">
<table width="100%" border="0" cellspacing="0" cellpadding="0"><tbody>
<tr>
<td><B>Hello World</B></td></tr></tbody>
</table>
</span>
<b>Codeplate Test</b><br><div id="SM5" class="sm_mod SM_rawHTML">
<B>Hello World</B></div>
<br>
Template Test Complete
';
$this->addTest('loadCodePlate()',
'Load a CodePlate, add some text from SM_siteManager root object',
Expand Down
19 changes: 0 additions & 19 deletions testSite/admin/modules/test_smartForms.mod
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,7 @@ class test_smartForms extends testBase {

$myForm->addDirective('badFormMessage','<center><b><br>There is a problem with the form input. Please correct your input and try again.</b><br><br></center>');

//$myForm->addDirective('showRequiredHelp',false);
//$myForm->addDirective('submitAlign','RIGHT');
//$myForm->addDirective('entityClassTag','sfEntity');

if ($this->getVar('loadXML') != 1) {

// tell it to use javascript
$myForm->addDirective('useJS',true);

$myForm->addDirective('cleanHiddens',true);

Expand All @@ -109,25 +102,13 @@ class test_smartForms extends testBase {



// swap control order
//$myForm->addDirective('swapControlOrder',true);

// dump template
$myForm->addDirective('dumpTemplate',true);

// misc directives
//$myForm->addDirective('controlsOnRight',true);
$myForm->addDirective('resetButton','Reset');
$myForm->addDirective('tableBorder','1');

// turn on alternating row colors
//$myForm->addDirective('rowColorAlt1','#FFFFFF');
//$myForm->addDirective('rowColorAlt2','#AAAAAA');

// styles for alternating rows
//$myForm->addDirective('normalClassTagAlt1','sfNormal1');
//$myForm->addDirective('normalClassTagAlt2','sfNormal2');

// default entity styles
//$myForm->addDirective('entityClassTag','testStyle');

Expand Down
13 changes: 6 additions & 7 deletions testSite/admin/modules/test_templates.mod
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ class test_templates extends testBase {
(sample text added to area)
<br>
Template Test Complete
';
$this->addTest('loadTemplate()',
'Load, parse and run template from file',
Expand All @@ -92,7 +93,7 @@ Template Test Complete
$tpt->setTemplateData($text);
$tpt->addText('(sample text added to area)','areaTwo');
$actual = $tpt->run();
$expect = '<b>Template From Code</b><Br><span class="sample">'."\n".'(sample text added to area)'."\n".'</span><br>Template Test Complete';
$expect = '<b>Template From Code</b><Br><div class="sample">'."\n".'(sample text added to area)'."\n".'</div>'."\n".'<br>Template Test Complete';
$this->addTest('setTemplateData',
'Create template, use template from code.',
$expect,
Expand Down Expand Up @@ -141,15 +142,12 @@ Template Test Complete
$cpt->addTemplate($tpt2, 'areaOne');
$actual = $cpt->run();
$expect = '<b>Sample Template</b><br>
<b>Codeplate Test</b><br><b>Sub Template Area Text<br></b>Bottom of Sub Template<span id="SM4">
<table width="100%" border="0" cellspacing="0" cellpadding="0"><tbody>
<tr>
<td><B>Hello World</B></td></tr></tbody>
</table>
</span>
<b>Codeplate Test</b><br><b>Sub Template Area Text<br></b>Bottom of Sub Template<div id="SM4" class="sm_mod SM_rawHTML">
<B>Hello World</B></div>
<br>
Template Test Complete
';
$this->addTest('Template in Codeplate',
'Load a CodePlate, add some text and another template to an area in the CodePlate',
Expand All @@ -165,6 +163,7 @@ EXAMPLE tag: babble
<br>
SM TAG Template Test Complete
';
$this->addTest('Custom SM Tag',
'Load a template that makes use of a custom template tag EXAMPLE',
Expand Down

0 comments on commit d4a23d0

Please sign in to comment.