Пример #1
0
 public function testFilter()
 {
     $filter = new FilterTest_Filter();
     $this->assertEquals('text', $filter->getFieldType());
     $this->assertEquals(array('required' => false), $filter->getFieldOptions());
     $this->assertNull($filter->getLabel());
     $options = array('label' => 'foo', 'field_type' => 'integer', 'field_options' => array('required' => true), 'field_name' => 'name');
     $filter->setOptions($options);
     $this->assertEquals('foo', $filter->getOption('label'));
     $this->assertEquals('foo', $filter->getLabel());
     $expected = $options;
     $expected['foo'] = 'bar';
     $this->assertEquals($expected, $filter->getOptions());
     $this->assertEquals('name', $filter->getFieldName());
     $this->assertEquals('default', $filter->getOption('fake', 'default'));
     $filter->setValue(42);
     $this->assertEquals(42, $filter->getValue());
     $filter->setCondition('>');
     $this->assertEquals('>', $filter->getCondition());
 }
Пример #2
0
 /**
  * @dataProvider isActiveData
  *
  * @param $expected
  * @param $value
  */
 public function testIsActive($expected, $value)
 {
     $filter = new FilterTest_Filter();
     $filter->setValue($value);
     $this->assertEquals($expected, $filter->isActive());
 }