public function testGetFileNamesGroupByText() { $this->clearedGetterTest = new TestClearedGetter(); $uploadId = 1; $parentId = 112; $uploadTreeTableName = "ut"; $this->uploadDao->shouldReceive('getUploadtreeTableName')->with($uploadId)->andReturn($uploadTreeTableName); $this->treeDao->shouldReceive('getMinimalCoveringItem')->with($uploadId, $uploadTreeTableName)->andReturn($parentId); $this->treeDao->shouldReceive('getFullPath')->with(1, $uploadTreeTableName, $parentId)->andReturn("a/1"); $this->treeDao->shouldReceive('getFullPath')->with(2, $uploadTreeTableName, $parentId)->andReturn("a/2"); $this->treeDao->shouldReceive('getFullPath')->with(3, $uploadTreeTableName, $parentId)->andReturn("a/b/1"); $tester = new TestClearedGetter("text"); $statements = $tester->getCleared($uploadId); $expected = array("statements" => array(array("content" => "1", "text" => "t1", "comments" => "c1", "files" => array("a/1")), array("content" => "1", "text" => "t2", "comments" => "c1", "files" => array("a/2")), array("content" => "2", "text" => "t3", "comments" => "c3", "files" => array("a/b/1")))); $expected = arsort($expected); assertThat($expected, equalTo($statements)); }