Skip to content

Instantly share code, notes, and snippets.

@radmiraal
Created June 1, 2012 07:01
Show Gist options
  • Save radmiraal/2849741 to your computer and use it in GitHub Desktop.
Save radmiraal/2849741 to your computer and use it in GitHub Desktop.
<?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;
}
}
?>
<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>
/**
* @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