/** * Test encodeFile encodes data properly * and saves it to the proper file. */ public function testEncodeFile() { $dataFilePath = self::$dataFileFixturesHelper->buildCreatedFilePath('data.yaml'); $data = self::$dataFileFixturesHelper->loadDecodedData(); $this->yamlDatafileEncoder->encodeFile($data, $dataFilePath); $expectedResult = self::$dataFileFixturesHelper->loadEncodedData(); $actualResult = file_get_contents($dataFilePath); $this->assertEquals($expectedResult, $actualResult); }
/** * Test encodeFile function returns proper result * when data format hasn't been set * and encoder must recognize format by file extension. */ public function testEncodeFileWhenDataFormatIsNotSet() { $expectedResult = "<FORMAT ENCODED DATA>Dummy data</FORMAT ENCODED DATA>"; $dataFilePath = self::$dataFileFixturesHelper->buildCreatedFilePath('data.format'); $this->datafileEncoder->encodeFile(array('Dummy data'), $dataFilePath); $actualResult = file_get_contents($dataFilePath); $this->assertEquals($expectedResult, $actualResult); }