public function testAdd() { $this->datagridMapper->add('fooName'); $this->assertTrue($this->datagridMapper->has('fooName')); $fieldDescription = $this->datagridMapper->get('fooName'); $this->assertInstanceOf('Sonata\\AdminBundle\\Filter\\FilterInterface', $fieldDescription); $this->assertEquals('fooName', $fieldDescription->getName()); }
public function testAddWithoutFieldName() { $this->datagridMapper->add('foo.bar'); $this->assertTrue($this->datagridMapper->has('foo.bar')); $fieldDescription = $this->datagridMapper->get('foo.bar'); $this->assertInstanceOf('Sonata\\AdminBundle\\Filter\\FilterInterface', $fieldDescription); $this->assertSame('foo.bar', $fieldDescription->getName()); $this->assertSame('bar', $fieldDescription->getOption('field_name')); }