/** * Decode file content. * * @param string $filePath * @return array * @throws \InvalidArgumentException */ public function decodeFile($filePath) { $file = new File($filePath); $fileData = $file->getContent(); $dataDecoder = new JsonDataDecoder(); $result = $dataDecoder->decodeData($fileData); return $result; }
/** * Test encodeData function properly decodes data * in the proper JSON format. */ public function testDecodeData() { $data = self::$dataFileFixturesHelper->loadEncodedData(); $expectedResult = self::$dataFileFixturesHelper->loadDecodedData(); $actualResult = $this->jsonDataDecoder->decodeData($data); $this->assertEquals($expectedResult, $actualResult); }