protected function registerFixedResponses() { $fixtures = Fixture::all(); foreach ($fixtures as $ext => $ext_fixtures) { foreach ($ext_fixtures as $fixture) { //skip count if ($fixture->name == 'count') { continue; } # register the count fixture for this resource, if it exists $this->responses->add(new Response('get', '/admin/' . $fixture->name . '/count.' . $ext, $fixtures[$ext]['count'])); # register the resource fixture $r = new Response('get', '/admin/' . $fixture->name . '.' . $ext, $fixture); $this->responses->add($r); if ($ext == 'json') { $data = $r->parseData(); if (is_array($data)) { foreach ($data as $datum) { if (!is_object($datum) || !property_exists($datum, 'id')) { continue; } $f = clone $fixture; $f->parsed = [$this->singularize($f->name) => $datum]; $this->responses->add(new Response('get', '/admin/' . $fixture->name . '/' . $datum->id . '.' . $ext, $f)); $this->responses->add(new Response('get', '/admin/' . $fixture->name . '/' . $datum->id . '/metafields.' . $ext, $fixtures[$ext]['metafields'])); } } } } } }
protected static function _file_exists($file) { if (strpos($file, 'not_found') !== false) { return false; } if (strpos($file, 'file1.json') !== false) { return true; } return parent::_file_exists($file); }