'val', 'confMainKey2' => 4, 'confMainKey3' => '', ); $expectedJson = json_encode(array('mainConfig' => $mainData)); $exporter = $this->getMockBuilder('\LAM\PERSISTENCE\ConfigDataExporter') ->setMethods(array('_getMainConfigData')) ->getMock(); $exporter->method('_getMainConfigData')->willReturn($mainData); $json = $exporter->exportAsJson(); $this->assertEquals($expectedJson, $json); } }