cvs: pear /HTML_TreeMenu/tests testBug_9750.phpt

[email protected] ("Chuck Burgess") Tue, 06 May 2008 14:06:22 -0000
Newsgroups php.pear.cvs
Message-ID <cvsashnazg1210082782@cvsserver>
ashnazg		Tue May  6 14:06:22 2008 UTC

  Added files:                 
    /pear/HTML_TreeMenu/tests	testBug_9750.phpt 
  Log:
  add a test for bug #9750 (though it's incomplete right now)
  

http://cvs.php.net/viewvc.cgi/pear/HTML_TreeMenu/tests/testBug_9750.phpt?view=markup&rev=1.1
Index: pear/HTML_TreeMenu/tests/testBug_9750.phpt
+++ pear/HTML_TreeMenu/tests/testBug_9750.phpt
--TEST--
HTML_TreeMenu tests for Bug #4950:  Using "kriesing" tree type the "nodeOptions" paramether is not working.
--CREDITS--
Chuck Burgess <[email protected]>
# created for v1.2.2 2008-05-06
--FILE--
<?php
echo '=====HTML_TreeMenu tests for Bug #9750:  Using "kriesing" tree type the "nodeOptions" paramether is not working.=====' . PHP_EOL . PHP_EOL;

echo 'TEST:  test case provided in bug report' . PHP_EOL;

require_once 'Tree' . DIRECTORY_SEPARATOR . 'Tree.php';
require_once 'Tree' . DIRECTORY_SEPARATOR . 'Memory.php';
require_once 'HTML' . DIRECTORY_SEPARATOR . 'TreeMenu.php';

$dbDsn = 'mysql://USER:PSWD@HOST/DBNAME';
$options = array ('order' => 'name', 'table' => 'mytree');

$tree = Tree::setup('Memory_DBnested', $dbDsn, $options);
$tree->setup();

$nodeOptions = array(
    'text'          => '',
    'link'          => 'editCategory.php?id=',
    'icon'          => 'folder.gif',
    'expandedIcon'  => 'folder-expanded.gif',
    'class'         => '',
    'expanded'      => false,
    'linkTarget'    => '_self',
    'isDynamic'     => 'true',
    'ensureVisible' => '',
); 	

$options = array(
    'structure'   => $tree,
    'type'        => 'kriesing', 
    'nodeOptions' => $nodeOptions
);
                    
$menu = &HTML_TreeMenu::createFromStructure($options);

// Chose a generator. You can generate DHTML or a Listbox
$dhtml = &new HTML_TreeMenu_DHTML(
    $menu, 
    array(
        'images'       => 'images',
        'defaultClass' => 'treeMenuDefault'
    )
);
$listbox = &new HTML_TreeMenu_ListBox(
    $menu, 
    array(
        'images'       => 'images',
        'defaultClass' => 'treeMenuDefault'
    )
);


echo 'TEST:  using DHTML' . PHP_EOL;
echo $dhtml->toHTML();

echo 'TEST:  using Listbox' . PHP_EOL;
echo $listbox->toHTML();

?>
--EXPECT--
=====HTML_TreeMenu tests for Bug #9750:  Using "kriesing" tree type the "nodeOptions" paramether is not working.====="

TEST:  test case provided in bug report
TEST:  using DHTML
TEST:  using ListBox