Browse files

Revert formatting

  • Loading branch information...
1 parent 4c21c65 commit 116c17c5e1245f4db404c43eea752ad0ebbc997d @rb-cohen rb-cohen committed Jan 4, 2013
Showing with 74 additions and 46 deletions.
  1. +74 −46 tests/ZendTest/Form/View/Helper/FormRowTest.php
View
120 tests/ZendTest/Form/View/Helper/FormRowTest.php
@@ -1,5 +1,4 @@
<?php
-
/**
* Zend Framework (http://framework.zend.com/)
*
@@ -22,23 +21,25 @@
* @package Zend_Form
* @subpackage UnitTest
*/
-class FormRowTest extends TestCase {
-
+class FormRowTest extends TestCase
+{
protected $helper;
protected $renderer;
- public function setUp() {
+ public function setUp()
+ {
$this->helper = new FormRowHelper();
$this->renderer = new PhpRenderer;
$helpers = $this->renderer->getHelperPluginManager();
- $config = new HelperConfig();
+ $config = new HelperConfig();
$config->configureServiceManager($helpers);
$this->helper->setView($this->renderer);
}
- public function testCanGenerateLabel() {
+ public function testCanGenerateLabel()
+ {
$element = new Element('foo');
$element->setLabel('The value for foo:');
$markup = $this->helper->render($element);
@@ -47,7 +48,8 @@ public function testCanGenerateLabel() {
$this->assertContains('</label>', $markup);
}
- public function testCanCreateLabelValueBeforeInput() {
+ public function testCanCreateLabelValueBeforeInput()
+ {
$element = new Element('foo');
$element->setLabel('The value for foo:');
$this->helper->setLabelPosition('prepend');
@@ -56,7 +58,8 @@ public function testCanCreateLabelValueBeforeInput() {
$this->assertContains('</label>', $markup);
}
- public function testCanCreateLabelValueAfterInput() {
+ public function testCanCreateLabelValueAfterInput()
+ {
$element = new Element('foo');
$element->setOptions(array(
'label' => 'The value for foo:',
@@ -67,7 +70,8 @@ public function testCanCreateLabelValueAfterInput() {
$this->assertContains('</label>', $markup);
}
- public function testCanRenderRowLabelAttributes() {
+ public function testCanRenderRowLabelAttributes()
+ {
$element = new Element('foo');
$element->setLabel('The value for foo:');
$element->setLabelAttributes(array('class' => 'bar'));
@@ -76,14 +80,16 @@ public function testCanRenderRowLabelAttributes() {
$this->assertContains("<label class=\"bar\">", $markup);
}
- public function testCanCreateMarkupWithoutLabel() {
+ public function testCanCreateMarkupWithoutLabel()
+ {
$element = new Element('foo');
$element->setAttribute('type', 'text');
$markup = $this->helper->render($element);
$this->assertRegexp('/<input name="foo" type="text"[^\/>]*\/?>/', $markup);
}
- public function testCanHandleMultiCheckboxesCorrectly() {
+ public function testCanHandleMultiCheckboxesCorrectly()
+ {
$options = array(
'This is the first label' => 'value1',
'This is the second label' => 'value2',
@@ -100,7 +106,9 @@ public function testCanHandleMultiCheckboxesCorrectly() {
$this->assertContains("<label>", $markup);
}
- public function testRenderAttributeId() {
+
+ public function testRenderAttributeId()
+ {
$element = new Element\Text('foo');
$element->setAttribute('type', 'text');
$element->setAttribute('id', 'textId');
@@ -110,8 +118,9 @@ public function testRenderAttributeId() {
$this->assertContains('<input type="text" name="foo" id="textId"', $markup);
}
- public function testCanRenderErrors() {
- $element = new Element('foo');
+ public function testCanRenderErrors()
+ {
+ $element = new Element('foo');
$element->setMessages(array(
'First error message',
'Second error message',
@@ -122,8 +131,9 @@ public function testCanRenderErrors() {
$this->assertRegexp('#<ul>\s*<li>First error message</li>\s*<li>Second error message</li>\s*<li>Third error message</li>\s*</ul>#s', $markup);
}
- public function testDoesNotRenderErrorsListIfSetToFalse() {
- $element = new Element('foo');
+ public function testDoesNotRenderErrorsListIfSetToFalse()
+ {
+ $element = new Element('foo');
$element->setMessages(array(
'First error message',
'Second error message',
@@ -134,8 +144,9 @@ public function testDoesNotRenderErrorsListIfSetToFalse() {
$this->assertRegexp('/<input name="foo" class="input-error" type="text" [^\/>]*\/?>/', $markup);
}
- public function testCanModifyDefaultErrorClass() {
- $element = new Element('foo');
+ public function testCanModifyDefaultErrorClass()
+ {
+ $element = new Element('foo');
$element->setMessages(array(
'Error message'
));
@@ -144,8 +155,9 @@ public function testCanModifyDefaultErrorClass() {
$this->assertRegexp('/<input name="foo" class="custom-error-class" type="text" [^\/>]*\/?>/', $markup);
}
- public function testDoesNotOverrideClassesIfAlreadyPresentWhenThereAreErrors() {
- $element = new Element('foo');
+ public function testDoesNotOverrideClassesIfAlreadyPresentWhenThereAreErrors()
+ {
+ $element = new Element('foo');
$element->setMessages(array(
'Error message'
));
@@ -155,18 +167,20 @@ public function testDoesNotOverrideClassesIfAlreadyPresentWhenThereAreErrors() {
$this->assertRegexp('/<input name="foo" class="foo bar custom-error-class" type="text" [^\/>]*\/?>/', $markup);
}
- public function testInvokeWithNoElementChainsHelper() {
+ public function testInvokeWithNoElementChainsHelper()
+ {
$this->assertSame($this->helper, $this->helper->__invoke());
}
- public function testLabelWillBeTranslated() {
+ public function testLabelWillBeTranslated()
+ {
$element = new Element('foo');
$element->setLabel('The value for foo:');
$mockTranslator = $this->getMock('Zend\I18n\Translator\Translator');
$mockTranslator->expects($this->any())
- ->method('translate')
- ->will($this->returnValue('translated content'));
+ ->method('translate')
+ ->will($this->returnValue('translated content'));
$this->helper->setTranslator($mockTranslator);
$this->assertTrue($this->helper->hasTranslator());
@@ -184,7 +198,8 @@ public function testLabelWillBeTranslated() {
$this->assertContains('</label>', $markup);
}
- public function testTranslatorMethods() {
+ public function testTranslatorMethods()
+ {
$translatorMock = $this->getMock('Zend\I18n\Translator\Translator');
$this->helper->setTranslator($translatorMock, 'foo');
@@ -197,46 +212,54 @@ public function testTranslatorMethods() {
$this->assertFalse($this->helper->isTranslatorEnabled());
}
- public function testInvokeSetLabelPositionToAppend() {
+ public function testInvokeSetLabelPositionToAppend()
+ {
$element = new Element('foo');
$this->helper->__invoke($element, 'append');
$this->assertSame('append', $this->helper->getLabelPosition());
}
- public function testSetLabelPositionInputNullRaisesException() {
+ public function testSetLabelPositionInputNullRaisesException()
+ {
$this->setExpectedException('Zend\Form\Exception\InvalidArgumentException');
$this->helper->setLabelPosition(null);
}
- public function testGetLabelPositionReturnsDefaultPrepend() {
+ public function testGetLabelPositionReturnsDefaultPrepend()
+ {
$labelPosition = $this->helper->getLabelPosition();
$this->assertEquals('prepend', $labelPosition);
}
- public function testGetLabelPositionReturnsAppend() {
+ public function testGetLabelPositionReturnsAppend()
+ {
$this->helper->setLabelPosition('append');
$labelPosition = $this->helper->getLabelPosition();
$this->assertEquals('append', $labelPosition);
}
- public function testGetRenderErrorsReturnsDefaultTrue() {
+ public function testGetRenderErrorsReturnsDefaultTrue()
+ {
$renderErrors = $this->helper->getRenderErrors();
$this->assertTrue($renderErrors);
}
- public function testGetRenderErrorsSetToFalse() {
+ public function testGetRenderErrorsSetToFalse()
+ {
$this->helper->setRenderErrors(false);
$renderErrors = $this->helper->getRenderErrors();
$this->assertFalse($renderErrors);
}
- public function testSetLabelAttributes() {
+ public function testSetLabelAttributes()
+ {
$this->helper->setLabelAttributes(array('foo', 'bar'));
$this->assertEquals(array(0 => 'foo', 1 => 'bar'), $this->helper->getLabelAttributes());
}
- public function testWhenUsingIdAndLabelBecomesEmptyRemoveSpan() {
+ public function testWhenUsingIdAndLabelBecomesEmptyRemoveSpan()
+ {
$element = new Element('foo');
$element->setLabel('The value for foo:');
@@ -251,12 +274,13 @@ public function testWhenUsingIdAndLabelBecomesEmptyRemoveSpan() {
$this->assertNotContains('</span>', $markup);
}
- public function testShowErrorInMultiCheckbox() {
+ public function testShowErrorInMultiCheckbox()
+ {
$element = new Element\MultiCheckbox('hobby');
$element->setLabel("Hobby");
$element->setValueOptions(array(
- '0' => 'working',
- '1' => 'coding'
+ '0'=>'working',
+ '1'=>'coding'
));
$element->setMessages(array(
'Error message'
@@ -266,12 +290,13 @@ public function testShowErrorInMultiCheckbox() {
$this->assertContains('<ul><li>Error message</li></ul>', $markup);
}
- public function testShowErrorInRadio() {
+ public function testShowErrorInRadio()
+ {
$element = new Element\Radio('direction');
$element->setLabel("Direction");
$element->setValueOptions(array(
- '0' => 'programming',
- '1' => 'design'
+ '0'=>'programming',
+ '1'=>'design'
));
$element->setMessages(array(
'Error message'
@@ -281,8 +306,9 @@ public function testShowErrorInRadio() {
$this->assertContains('<ul><li>Error message</li></ul>', $markup);
}
- public function testErrorShowTwice() {
- $element = new Element\Date('birth');
+ public function testErrorShowTwice()
+ {
+ $element = new Element\Date('birth');
$element->setFormat('Y-m-d');
$element->setValue('2010-13-13');
@@ -291,24 +317,26 @@ public function testErrorShowTwice() {
$element->setMessages($validator->getMessages());
$markup = $this->helper->__invoke($element);
- $this->assertEquals(2, count(explode("<ul><li>The input does not appear to be a valid date</li></ul>", $markup)));
+ $this->assertEquals(2, count(explode("<ul><li>The input does not appear to be a valid date</li></ul>", $markup)));
}
-
- public function testInvokeWithNoRenderErrors() {
+
+ public function testInvokeWithNoRenderErrors()
+ {
$mock = $this->getMock(get_class($this->helper), array('setRenderErrors'));
$mock->expects($this->never())
->method('setRenderErrors');
$mock->__invoke(new Element('foo'));
}
- public function testInvokeWithRenderErrorsTrue() {
+ public function testInvokeWithRenderErrorsTrue()
+ {
$mock = $this->getMock(get_class($this->helper), array('setRenderErrors'));
$mock->expects($this->once())
->method('setRenderErrors')
->with(true);
$mock->__invoke(new Element('foo'), null, true);
}
-
+
}

0 comments on commit 116c17c

Please sign in to comment.