Created
June 1, 2012 07:01
-
-
Save radmiraal/2849741 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace TYPO3\Fluid\Tests\Functional\Form\Fixtures\Domain\Model; | |
/* * | |
* This script belongs to the FLOW3 package "Fluid". * | |
* * | |
* It is free software; you can redistribute it and/or modify it under * | |
* the terms of the GNU Lesser General Public License, either version 3 * | |
* of the License, or (at your option) any later version. * | |
* * | |
* The TYPO3 project - inspiring people to share! * | |
* */ | |
use TYPO3\FLOW3\Annotations as FLOW3; | |
/** | |
* A test entity which is used to test Fluid forms in combination with | |
* property mapping | |
* | |
* @FLOW3\Entity | |
*/ | |
class Post { | |
/** | |
* @var string | |
*/ | |
protected $name; | |
/** | |
* @var string | |
* @FLOW3\Validate(type="EmailAddress") | |
*/ | |
protected $email; | |
/** | |
* @var boolean | |
*/ | |
protected $isPrivate = TRUE; | |
/** | |
* @return string | |
*/ | |
public function getName() { | |
return $this->name; | |
} | |
/** | |
* @param string $name | |
*/ | |
public function setName($name) { | |
$this->name = $name; | |
} | |
/** | |
* @return string | |
*/ | |
public function getEmail() { | |
return $this->email; | |
} | |
/** | |
* @param string $email | |
*/ | |
public function setEmail($email) { | |
$this->email = $email; | |
} | |
/** | |
* @param boolean $isPrivate | |
*/ | |
public function setIsPrivate($isPrivate) { | |
$this->isPrivate = $isPrivate; | |
} | |
/** | |
* @return boolean | |
*/ | |
public function getIsPrivate() { | |
return $this->isPrivate; | |
} | |
} | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h2>My Form</h2> | |
<f:form action="create" name="post" object="{fooPost}"> | |
<f:form.textfield id="name" property="name" /> | |
<f:form.textfield id="email" property="email" /> | |
<f:form.checkbox id="isPrivate" property="isPrivate" value="1" /> | |
<f:form.submit>Abschicken</f:form.submit> | |
</f:form> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @test | |
*/ | |
public function checkboxIsCheckedByDefaultOnPropertiesWithDefaulTrueValue() { | |
$this->browser->request('http://localhost/test/fluid/formobjects'); | |
$this->assertEquals('email', $this->browser->getCrawler()->filterXPath('//input[@id="email"]')->attr('id')); | |
$this->assertEquals('isPrivate', $this->browser->getCrawler()->filterXPath('//input[@id="isPrivate"]')->attr('id')); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment