/** * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException * @expectedExceptionMessage Error parsing JSON - Syntax error, malformed JSON */ public function testParseException() { $loader = new JsonFileLoader(); $resource = __DIR__ . '/../fixtures/malformed.json'; $loader->load($resource, 'en', 'domain1'); }
/** * Initialize filerev catalogue from filerev.json * * @param string $summaryFile Grunt filerev summary file */ protected function initializeCatalogue($summaryFile) { // try to fetch config file generated by filerev // use empty cataloge if file does not exist $locator = new FileLocator(array(dirname($summaryFile), __DIR__ . '/../../Resources/config')); try { $resources = $locator->locate(basename($summaryFile), null, false); if (is_array($resources) && count($resources)) { $resource = array_shift($resources); $loader = new JsonFileLoader(); $this->summary = $loader->load($resource, null); return; } } catch (\InvalidArgumentException $e) { // no summary set } $this->summary = new MessageCatalogue(null); }