/** * Testing you can dynamically add rules to a field, added this to dispel doubts * after a presentation made to show off this new feature * * @return void */ public function testDynamicValidationRuleBuilding() { $model = new Boat(); $validator = $model->validator(); $validator->add('body', 'isSpecial', array('rule' => 'special')); $rules = $validator['body']->getRules(); $this->assertCount(2, $rules); $this->assertEquals('special', $rules['isSpecial']->rule); $validator['body']->setRule('isAwesome', array('rule' => 'awesome')); $rules = $validator['body']->getRules(); $this->assertCount(3, $rules); $this->assertEquals('awesome', $rules['isAwesome']->rule); }