Esempio n. 1
0
 public function testFilter()
 {
     $filter = new FooFilter();
     $this->assertSame('text', $filter->getFieldType());
     $this->assertSame(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->assertSame('foo', $filter->getOption('label'));
     $this->assertSame('foo', $filter->getLabel());
     $expected = array_merge(array('foo' => 'bar'), $options);
     $this->assertSame($expected, $filter->getOptions());
     $this->assertSame('name', $filter->getFieldName());
     $this->assertSame('default', $filter->getOption('fake', 'default'));
     $filter->setValue(42);
     $this->assertSame(42, $filter->getValue());
     $filter->setCondition('>');
     $this->assertSame('>', $filter->getCondition());
 }
Esempio n. 2
0
 public function testFilter()
 {
     $filter = new FooFilter();
     $this->assertSame('Symfony\\Component\\Form\\Extension\\Core\\Type\\TextType', $filter->getFieldType());
     $this->assertSame(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->assertSame('foo', $filter->getOption('label'));
     $this->assertSame('foo', $filter->getLabel());
     $expected = array_merge(array('show_filter' => null, 'advanced_filter' => true, 'foo' => 'bar'), $options);
     $this->assertSame($expected, $filter->getOptions());
     $this->assertSame('name', $filter->getFieldName());
     $this->assertSame('default', $filter->getOption('fake', 'default'));
     $filter->setValue(42);
     $this->assertSame(42, $filter->getValue());
     $filter->setCondition('>');
     $this->assertSame('>', $filter->getCondition());
 }
Esempio n. 3
0
 public function testFilter()
 {
     $filter = new FooFilter();
     $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';
     $expected['show_filter'] = null;
     $expected['advanced_filter'] = true;
     $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());
 }