public function testFailedSave() { $reflectionProperty = $this->getMockBuilder('\\ReflectionProperty')->disableOriginalConstructor()->getMock(); $reflectionProperty->expects($this->any())->method('getValue')->will($this->returnValue(1)); $meta = $this->getMockBuilder('Doctrine\\ORM\\Mapping\\ClassMetadata')->disableOriginalConstructor()->getMock(); $this->om->expects($this->any())->method('getClassMetadata')->will($this->returnValue($meta)); $meta->expects($this->any())->method('getReflectionProperty')->will($this->returnValue($reflectionProperty)); $meta->expects($this->any())->method('getSingleIdentifierFieldName')->will($this->returnValue('id')); $this->assertEquals(false, $this->orm->save(new Attribute(), true)); }