Skip to content

Commit

Permalink
[Validator] Various test changes
Browse files Browse the repository at this point in the history
* Remove obsolete tests.
* Mark incomplete tests.
  • Loading branch information
Maks3w committed May 10, 2012
1 parent 58ece26 commit 4094bae
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 35 deletions.
21 changes: 10 additions & 11 deletions tests/Zend/Validator/FloatTest.php
Expand Up @@ -20,17 +20,14 @@
*/

namespace ZendTest\Validator;

use Zend\Validator,
ReflectionClass;

/**
* Test helper
*/

/**
* @see Zend_Validator_Float
*/

/**
* @category Zend
* @package Zend_Validator
Expand Down Expand Up @@ -82,23 +79,25 @@ public function tearDown()
/**
* Ensures that the validator follows expected behavior
*
* @dataProvider basicProvider
* @return void
*/
public function testBasic()
public function testBasic($value, $expected)
{
$valuesExpected = array(
$this->assertEquals($expected, $this->_validator->isValid($value),
'Failed expecting ' . $value . ' being ' . ($expected ? 'true' : 'false'));
}

public function basicProvider() {
return array(
array(1.00, true),
array(0.01, true),
array(-0.1, true),
array('10.1', true),
array(1, true),
array('not a float', false),
);
foreach ($valuesExpected as $element) {
$this->assertEquals($element[1], $this->_validator->isValid($element[0]), 'Failed expecting ' . $element[0] . ' being ' . ($element[1] ? 'true' : 'false'));
}
);
}

/**
* Ensures that getMessages() returns expected default value
*
Expand Down
2 changes: 1 addition & 1 deletion tests/Zend/Validator/Sitemap/LocTest.php
Expand Up @@ -95,7 +95,7 @@ public static function invalidLocs()
*/
public function testInvalidLocs($url)
{
$this->markTestSkipped('Test must be reworked');
$this->markTestIncomplete('Test must be reworked');
$this->assertFalse($this->_validator->isValid($url), $url);
$messages = $this->_validator->getMessages();
$this->assertContains('is not a valid', current($messages));
Expand Down
23 changes: 0 additions & 23 deletions tests/Zend/Validator/ValidateTest.php
Expand Up @@ -101,29 +101,6 @@ public function testBreakChainOnFailure()
$this->assertEquals(array('error' => 'validation failed'), $this->_validator->getMessages());
}

/**
* Ensures that we can call the static method is()
* to instantiate a named validator by its class basename
* and it returns the result of isValid() with the input.
*/
public function testStaticFactory()
{
$this->markTestSkipped('is() method should not try to implement its own plugin loader- refactor this');
$this->assertTrue(Validator\ValidatorChain::execute('1234', 'Digits'));
$this->assertFalse(Validator\ValidatorChain::execute('abc', 'Digits'));
}

/**
* Ensures that a validator with constructor arguments can be called
* with the static method is().
*/
public function testStaticFactoryWithConstructorArguments()
{
$this->markTestSkipped('is() method should not try to implement its own plugin loader - refactor this');
$this->assertTrue(Validator\ValidatorChain::execute('12', 'Between', array('min' => 1, 'max' => 12)));
$this->assertFalse(Validator\ValidatorChain::execute('24', 'Between', array('min' => 1, 'max' => 12)));
}

/**
* Ensures that if we specify a validator class basename that doesn't
* exist in the namespace, is() throws an exception.
Expand Down

0 comments on commit 4094bae

Please sign in to comment.