Exemplo n.º 1
0
 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));
 }
Exemplo n.º 2
0
 /**
  * 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);
 }