public function testHasAssociationAdmin() { $adminMock = $this->getMockBuilder('Sonata\\AdminBundle\\Admin\\Admin')->disableOriginalConstructor()->getMock(); $adminMock->expects($this->once())->method('setParentFieldDescription')->with($this->isInstanceOf('Sonata\\AdminBundle\\Admin\\FieldDescriptionInterface')); $field = new FieldDescription(); $this->assertFalse($field->hasAssociationAdmin()); $field->setAssociationAdmin($adminMock); $this->assertTrue($field->hasAssociationAdmin()); }