/** * Test the filter() method. */ public function testFilter() { // Without enum. Should return default 'default': '' $value = 4; $this->assertEquals('', $this->filter->filter($value)); // With enum, but without that value $this->filter->setEnum(array(1 => "Xyz", 2 => "basic")); $this->assertEquals('', $this->filter->filter($value)); // With enum, without that value, with default defined. $default = "-"; $this->filter->setDefault($default); $this->assertEquals($default, $this->filter->filter($value)); // With enum which includes given value $this->filter->setEnum(array(1 => "Xyz", 2 => "basic", 4 => 'OK', 5 => 'NOK')); $this->assertEquals('OK', $this->filter->filter($value)); }