public function testOptionalField() { $this->v->required('optional_set_as_required')->with(new \Rule\UUID('v4')); $this->v->optional('optional')->with(new \Rule\Alpha()); $this->v->optional('mdim[notvalid][optional]')->with(new \Rule\Alpha()); $this->v->key('mdim[valid][valid]')->with(new \Rule\Numeric()); $this->v->optional('mdim[valid][valid]')->with(new \Rule\Numeric()); $this->assertArrayNotHasKey('optional', $this->v->getErrors()); $this->assertArrayNotHasKey('mdim[notvalid][optional]', $this->v->getErrors()); $this->assertArrayHasKey('optional_set_as_required', $this->v->getErrors()); $this->assertArrayHasKey('mdim[valid][valid]', $this->v->getErrors()); }