diff --git a/cake/tests/cases/libs/view/helpers/html.test.php b/cake/tests/cases/libs/view/helpers/html.test.php index 8a8b25f04..0b6b9ee0e 100644 --- a/cake/tests/cases/libs/view/helpers/html.test.php +++ b/cake/tests/cases/libs/view/helpers/html.test.php @@ -49,8 +49,6 @@ class TheHtmlTestController extends Controller { public $uses = null; } -Mock::generate('View', 'HtmlHelperMockView'); - /** * HtmlHelperTest class * @@ -474,14 +472,18 @@ class HtmlHelperTest extends CakeTestCase { $this->assertEqual(count($result), 2); ClassRegistry::removeObject('view'); - $view =& new HtmlHelperMockView(); + $view = $this->getMock('View', array(), array(), '', false); ClassRegistry::addObject('view', $view); - $view->expectAt(0, 'addScript', array(new PatternExpectation('/css_in_head.css/'))); + $view->expects($this->any())->method('addScript')->with($this->matchesRegularExpression('/css_in_head.css/')); $result = $this->Html->css('css_in_head', null, array('inline' => false)); $this->assertNull($result); - $view =& ClassRegistry::getObject('view'); - $view->expectAt(1, 'addScript', array(new NoPatternExpectation('/inline=""/'))); + ClassRegistry::removeObject('view'); + $view = $this->getMock('View', array(), array(), '', false); + ClassRegistry::addObject('view', $view); + $view->expects($this->any()) + ->method('addScript') + ->with($this->matchesRegularExpression('/more_css_in_head.css/')); $result = $this->Html->css('more_css_in_head', null, array('inline' => false)); $this->assertNull($result); } @@ -607,9 +609,10 @@ class HtmlHelperTest extends CakeTestCase { ); $this->assertTags($result, $expected); - $view =& ClassRegistry::getObject('view'); - $view =& new HtmlHelperMockView(); - $view->expectAt(0, 'addScript', array(new PatternExpectation('/script_in_head.js/'))); + ClassRegistry::removeObject('view'); + $view = $this->getMock('View', array(), array(), '', false); + ClassRegistry::addObject('view', $view); + $view->expects($this->any())->method('addScript')->with($this->matchesRegularExpression('/script_in_head.js/')); $result = $this->Html->script('script_in_head', array('inline' => false)); $this->assertNull($result); } @@ -648,9 +651,11 @@ class HtmlHelperTest extends CakeTestCase { ); $this->assertTags($result, $expected); - $view =& ClassRegistry::getObject('view'); - $view =& new HtmlHelperMockView(); - $view->expectAt(0, 'addScript', array(new PatternExpectation('/window\.foo\s\=\s2;/'))); + ClassRegistry::removeObject('view'); + $view = $this->getMock('View', array(), array(), '', false); + ClassRegistry::addObject('view', $view); + $view->expects($this->any())->method('addScript') + ->with($this->matchesRegularExpression('/window\.foo\s\=\s2;/')); $result = $this->Html->scriptBlock('window.foo = 2;', array('inline' => false)); $this->assertNull($result); @@ -698,10 +703,10 @@ class HtmlHelperTest extends CakeTestCase { $this->assertTags($result, $expected); ClassRegistry::removeObject('view'); - $View =& new HtmlHelperMockView(); + $view = $this->getMock('View', array(), array(), '', false); + ClassRegistry::addObject('view', $view); - $View->expectOnce('addScript'); - ClassRegistry::addObject('view', $View); + $view->expects($this->once())->method('addScript'); $result = $this->Html->scriptStart(array('safe' => false, 'inline' => false)); $this->assertNull($result); @@ -1121,10 +1126,10 @@ class HtmlHelperTest extends CakeTestCase { $result = $this->Html->meta(array('name' => 'ROBOTS', 'content' => 'ALL')); $this->assertTags($result, array('meta' => array('name' => 'ROBOTS', 'content' => 'ALL'))); - $viewMock = new HtmlHelperMockView(); - $viewMock->expectOnce('addScript', array(new PatternExpectation('/^getMock('View', array(), array(), '', false); + ClassRegistry::addObject('view', $view); + $view->expects($this->any())->method('addScript')->with($this->matchesRegularExpression('/^assertNull($this->Html->meta(array('name' => 'ROBOTS', 'content' => 'ALL'), null, array('inline' => false))); }