Browse Source

format

master
Ilya Sigunov 13 years ago
parent
commit
522a4441f1
  1. 7
      tests/form/FormFieldTest.php
  2. 38
      tests/form/FormTest.php

7
tests/form/FormFieldTest.php

@ -15,7 +15,6 @@ require_once dirname(__FILE__) . '/../../validator/NotEmptyValidator.php';
require_once dirname(__FILE__) . '/../../validator/EmailValidator.php'; require_once dirname(__FILE__) . '/../../validator/EmailValidator.php';
require_once dirname(__FILE__) . '/../../form/FormField.php'; require_once dirname(__FILE__) . '/../../form/FormField.php';
class FormFieldTest extends PHPUnit_Framework_TestCase class FormFieldTest extends PHPUnit_Framework_TestCase
{ {
public function setUp() public function setUp()
@ -105,7 +104,6 @@ class FormFieldTest extends PHPUnit_Framework_TestCase
$tmp_form_field->addValidator($validator); $tmp_form_field->addValidator($validator);
} }
public function testAddFilters() public function testAddFilters()
{ {
$array = array('loginFilter' => new loginFilter(),'passwordFilter' => new passwordFilter()); $array = array('loginFilter' => new loginFilter(),'passwordFilter' => new passwordFilter());
@ -146,7 +144,6 @@ class FormFieldTest extends PHPUnit_Framework_TestCase
$tmp_form_field->addFilter($filter); $tmp_form_field->addFilter($filter);
} }
public function testGetValueArray() public function testGetValueArray()
{ {
$form = new FormField(); $form = new FormField();
@ -241,7 +238,7 @@ interface iFilter
public function getMessage(); public function getMessage();
} }
Class loginFilter implements iFilter
class loginFilter implements iFilter
{ {
public function filter($value) public function filter($value)
{ {
@ -259,7 +256,7 @@ Class loginFilter implements iFilter
} }
} }
Class passwordFilter implements iFilter
class passwordFilter implements iFilter
{ {
public function filter($value) public function filter($value)
{ {

38
tests/form/FormTest.php

@ -92,8 +92,7 @@ class FormTest extends PHPUnit_Framework_TestCase
$this->assertSame(1, $form->isValid($fields)); $this->assertSame(1, $form->isValid($fields));
$this->assertEquals($fields, $form->getValues()); $this->assertEquals($fields, $form->getValues());
} }
public function testGetValueCorrect() public function testGetValueCorrect()
{ {
$form = new NotEmptyForm(); $form = new NotEmptyForm();
@ -106,7 +105,6 @@ class FormTest extends PHPUnit_Framework_TestCase
$this->assertEquals($fields['password'], $form->getValue('password')); $this->assertEquals($fields['password'], $form->getValue('password'));
} }
public function testGetValueMissing() public function testGetValueMissing()
{ {
$form = new NotEmptyForm(); $form = new NotEmptyForm();
@ -118,7 +116,6 @@ class FormTest extends PHPUnit_Framework_TestCase
$this->assertEquals('', $form->getValue('password')); $this->assertEquals('', $form->getValue('password'));
} }
public function testGetValueMissingFieldLogin() public function testGetValueMissingFieldLogin()
{ {
$form = new NotEmptyForm(); $form = new NotEmptyForm();
@ -130,7 +127,6 @@ class FormTest extends PHPUnit_Framework_TestCase
$this->assertEquals('', $form->getValue('passwordw')); $this->assertEquals('', $form->getValue('passwordw'));
} }
public function testGetValueMissingFieldPassword() public function testGetValueMissingFieldPassword()
{ {
$form = new NotEmptyForm(); $form = new NotEmptyForm();
@ -166,7 +162,6 @@ class FormTest extends PHPUnit_Framework_TestCase
$this->assertEquals($form->getMessageType(), Form::ERROR); $this->assertEquals($form->getMessageType(), Form::ERROR);
} }
public function testGetMessageCorrect() public function testGetMessageCorrect()
{ {
$form = new NotEmptyForm(); $form = new NotEmptyForm();
@ -179,7 +174,6 @@ class FormTest extends PHPUnit_Framework_TestCase
$this->assertEquals('message', $form->getMessage()); $this->assertEquals('message', $form->getMessage());
} }
public function testGetMessageMissing() public function testGetMessageMissing()
{ {
$form = new NotEmptyForm(); $form = new NotEmptyForm();
@ -191,7 +185,6 @@ class FormTest extends PHPUnit_Framework_TestCase
$this->assertEquals('message', $form->getMessage()); $this->assertEquals('message', $form->getMessage());
} }
public function testSetSuccessMessage() public function testSetSuccessMessage()
{ {
$form = new NotEmptyForm(); $form = new NotEmptyForm();
@ -233,33 +226,4 @@ class NotEmptyForm extends Form
$validator->setMessage('Enter your password.'); $validator->setMessage('Enter your password.');
$this->addField('password')->addValidator($validator); $this->addField('password')->addValidator($validator);
} }
}
class NullForm extends Form
{
public function init()
{
/**/
}
}
class FooTest extends PHPUnit_Framework_TestCase
{
/**
* @covers Foo::doSomethingPrivate
*/
public function testPrivateMethod()
{
$method = new ReflectionMethod(
'Foo', 'doSomethingPrivate'
);
$method->setAccessible(TRUE);
$this->assertEquals(
'blah', $method->invoke(new Foo)
);
}
} }
Loading…
Cancel
Save