view = new Zend_View(); $this->helper = new Zend_View_Helper_FormLabel(); $this->helper->setView($this->view); } /** * Tears down the fixture, for example, close a network connection. * This method is called after a test is executed. * * @access protected */ protected function tearDown() { } public function testFormLabelWithSaneInput() { $label = $this->helper->formLabel('foo', 'bar'); $this->assertEquals('', $label); } public function testFormLabelWithInputNeedingEscapesUsesViewEscaping() { $label = $this->helper->formLabel('<&foo', ''); $expected = ''; $this->assertEquals($expected, $label); } public function testViewIsSetAndSameAsCallingViewObject() { $this->assertTrue(isset($this->helper->view)); $this->assertTrue($this->helper->view instanceof Zend_View_Interface); $this->assertSame($this->view, $this->helper->view); } public function testAttribsAreSet() { $label = $this->helper->formLabel('foo', 'bar', array('class' => 'baz')); $this->assertEquals('', $label); } public function testNameAndIdForZF2154() { $label = $this->helper->formLabel('name', 'value', array('id' => 'id')); $this->assertEquals('', $label); } /** * @group ZF-2473 */ public function testCanDisableEscapingLabelValue() { $label = $this->helper->formLabel('foo', 'Label This!', array('escape' => false)); $this->assertContains('Label This!', $label); $label = $this->helper->formLabel(array('name' => 'foo', 'value' => 'Label This!', 'escape' => false)); $this->assertContains('Label This!', $label); $label = $this->helper->formLabel(array('name' => 'foo', 'value' => 'Label This!', 'attribs' => array('escape' => false))); $this->assertContains('Label This!', $label); } /** * @group ZF-6426 */ public function testHelperShouldAllowSuppressionOfForAttribute() { $label = $this->helper->formLabel('foo', 'bar', array('disableFor' => true)); $this->assertNotContains('for="foo"', $label); } } // Call Zend_View_Helper_FormLabelTest::main() if this source file is executed directly. if (PHPUnit_MAIN_METHOD == "Zend_View_Helper_FormLabelTest::main") { Zend_View_Helper_FormLabelTest::main(); }