/** * @expectedException Gittern\Exception\NotPersistedException * @expectedExceptionMessage Object referred to by node named abacus is not persisted yet. */ public function testCantDesiccateTreeWithoutAllRelationsPersisted() { $desiccator = new TreeDesiccator(); $tree = M::mock('Gittern\\Entity\\GitObject\\Tree'); $node_mock = M::mock('Gittern\\Entity\\GitObject\\Node\\TreeNode', array('getOctalModeString' => '040000', 'getName' => 'abacus')); $node_mock->shouldReceive('getRelatedObject')->andReturn($node_mock); $node_mock->shouldReceive('getSha')->andReturn(null); $tree->shouldReceive('getNodes')->andReturn(array($node_mock)); $desiccator->desiccate($tree); }