Skip to content

Commit

Permalink
Unit testing the remove method
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Nov 20, 2013
1 parent f1cd45c commit 9e84249
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Cake/Test/TestCase/ORM/ValidatorTest.php
Expand Up @@ -69,4 +69,25 @@ public function testFieldSetter() {
$this->assertSame($validationSet, $validator->field('thing'));
}

/**
* Tests the remove method
*
* @return void
*/
public function testRemove() {
$validator = new Validator;
$validator->add('title', 'not-empty', ['rule' => 'notEmpty']);
$validator->add('title', 'foo', ['rule' => 'bar']);
$this->assertCount(2, $validator->field('title'));
$validator->remove('title');
$this->assertCount(0, $validator->field('title'));
$validator->remove('title');

$validator->add('title', 'not-empty', ['rule' => 'notEmpty']);
$validator->add('title', 'foo', ['rule' => 'bar']);
$this->assertCount(2, $validator->field('title'));
$validator->remove('title', 'foo');
$this->assertCount(1, $validator->field('title'));
$this->assertNull($validator->field('title')->rule('foo'));
}
}

0 comments on commit 9e84249

Please sign in to comment.