Created
August 12, 2011 13:12
-
-
Save robertbasic/1142003 to your computer and use it in GitHub Desktop.
Unit testing symfony2 forms
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 | |
| class ContactTest extends \PHPUnit_Framework_TestCase | |
| { | |
| public function setUp() | |
| { | |
| $ext = new CoreExtension(); | |
| $message = new Message(); | |
| $factory = new FormFactory(array( | |
| $ext | |
| )); | |
| $this->form = $factory->create(new Contact(), $message); | |
| } | |
| public function testFormNameIsContact() | |
| { | |
| $this->assertEquals('contact', $this->form->getName()); | |
| } | |
| public function testFormHasAllTheFields() | |
| { | |
| $this->assertTrue($this->form->has('name')); | |
| $this->assertTrue($this->form->has('email')); | |
| $this->assertTrue($this->form->has('subject')); | |
| $this->assertTrue($this->form->has('message')); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment