PHP Classes
elePHPant
Icontem

File: tests/unit/Del/Field/TextTest.php

Recommend this page to a friend!
  Classes of Derek McLean  >  HTML Forms  >  tests/unit/Del/Field/TextTest.php  >  Download  
File: tests/unit/Del/Field/TextTest.php
Role: Class source
Content type: text/plain
Description: Class source
Class: HTML Forms
Generate and validate submitted HTML forms
Author: By
Last change:
Date: 8 months ago
Size: 654 bytes
 

Contents

Class file image Download
<?php

namespace DelTesting\Form\Field;

use
Codeception\TestCase\Test;
use
Del\Form\Form;
use
Del\Form\Field\Text;

/**
 * User: delboy1978uk
 * Date: 05/12/2016
 * Time: 02:27
 */
class TextTest extends Test
{
    public function
testRequiredField()
    {
       
$form = new Form('required-text-form');
       
$text = new Text('text');
       
$text->setRequired(true);
       
$form->addField($text);
       
$this->assertFalse($form->isValid());
       
$text->setValue('something');
       
$this->assertTrue($form->isValid());
       
$text->setValue(null);
       
$text->setRequired(false);
       
$this->assertTrue($form->isValid());

    }
}