public function testFormatJsonInvalidCustomFormatStrings() { $originalData = file_get_contents($this->fixtures() . 'testdata.json'); $this->formatter->setIgnorePrettyPrint(true); $this->formatter->setIndentation('junk'); $this->formatter->setIndentation("foo\n"); $formattedData = $this->formatter->formatJson($originalData); $this->assertNull(json_decode($formattedData, true)); }
/** * Do the internal work of storing the modified data. */ private function store() { LoggerRegistry::debug('JsonFileUserStorage::store()'); if ($this->format) { $formatter = new JsonFormatter(); $result = $formatter->formatJson($this->users); } else { $result = json_encode($this->users); } file_put_contents($this->filename, $result); }