Adding fix for #2823, fixes Element gets different instances of helper than view in PHP4 and PHP5

Removed HtmlHelperTest::testRadio(), the HtmlHelper::radio() has been deprecated

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5379 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2007-07-06 04:31:45 +00:00
parent 4ff21a6a08
commit fb0a327a38
3 changed files with 11 additions and 17 deletions

View file

@ -744,7 +744,7 @@ class View extends Object {
${$camelBackedHelper}->{$subHelper} =& $loadedHelpers[$subHelper]; ${$camelBackedHelper}->{$subHelper} =& $loadedHelpers[$subHelper];
} }
} }
$this->loaded[$camelBackedHelper] = (${$camelBackedHelper}); $this->loaded[$camelBackedHelper] =& ${$camelBackedHelper};
} }
} }

View file

@ -742,7 +742,6 @@ class FormHelperTest extends CakeTestCase {
$this->assertEqual($result, '<input type="hidden" name="data[Contact][published]" value="0" id="theID_" /><input type="checkbox" name="data[Contact][published]" type="checkbox" id="theID" value="1" />'); $this->assertEqual($result, '<input type="hidden" name="data[Contact][published]" value="0" id="theID_" /><input type="checkbox" name="data[Contact][published]" type="checkbox" id="theID" value="1" />');
} }
function tearDown() { function tearDown() {
unset($this->Form); unset($this->Form);
} }

View file

@ -40,46 +40,41 @@ class TheHtmlTestController extends Controller {
class HtmlHelperTest extends UnitTestCase { class HtmlHelperTest extends UnitTestCase {
var $html = null; var $html = null;
function setUp() { function setUp() {
$this->Html =& new HtmlHelper(); $this->Html =& new HtmlHelper();
$view =& new View(new TheHtmlTestController()); $view =& new View(new TheHtmlTestController());
ClassRegistry::addObject('view', $view); ClassRegistry::addObject('view', $view);
} }
function testLinkEscape() { function testLinkEscape() {
$result = $this->Html->link('Next >', '#'); $result = $this->Html->link('Next >', '#');
$expected = '/^<a href="#"\s+>Next &gt;<\/a>$/'; $expected = '/^<a href="#"\s+>Next &gt;<\/a>$/';
$this->assertPattern($expected, $result); $this->assertPattern($expected, $result);
$result = $this->Html->link('Next >', '#', array('escape' => false)); $result = $this->Html->link('Next >', '#', array('escape' => false));
$expected = '/^<a href="#"\s+>Next ><\/a>$/'; $expected = '/^<a href="#"\s+>Next ><\/a>$/';
$this->assertPattern($expected, $result); $this->assertPattern($expected, $result);
} }
function testImageLink() { function testImageLink() {
$result = $this->Html->link($this->Html->image('test.gif'), '#', array(), false, false, false); $result = $this->Html->link($this->Html->image('test.gif'), '#', array(), false, false, false);
$expected = '/^<a href="#"\s+><img\s+src="img\/test.gif"\s+alt=""\s+\/><\/a>$/'; $expected = '/^<a href="#"\s+><img\s+src="img\/test.gif"\s+alt=""\s+\/><\/a>$/';
$this->assertPattern($expected, $result); $this->assertPattern($expected, $result);
} }
function testRadio() {
$result = $this->Html->radio('Tests/process', array('0'=> 'zero', '1'=>'one'));
$this->assertNoPattern('/checked="checked"/', $result);
}
function testStyle() { function testStyle() {
$result = $this->Html->style(array('display'=> 'none', 'margin'=>'10px')); $result = $this->Html->style(array('display'=> 'none', 'margin'=>'10px'));
$expected = 'style="display:none; margin:10px;"'; $expected = 'style="display:none; margin:10px;"';
$this->assertEqual($expected, $result); $this->assertEqual($expected, $result);
$result = $this->Html->style(array('display'=> 'none', 'margin'=>'10px'), false); $result = $this->Html->style(array('display'=> 'none', 'margin'=>'10px'), false);
$expected = "display:none;\nmargin:10px;"; $expected = "display:none;\nmargin:10px;";
$this->assertEqual($expected, $result); $this->assertEqual($expected, $result);
} }
function tearDown() { function tearDown() {