/** * Returns the class name of this hash, possibly * taking the parent element into the name. this * string here results in the name of the generated Document. * * @param boolean $fq if true, we'll return the class name full qualified * * @return string */ public function getClassName($fq = false) { $className = ucfirst($this->parent->getId()) . ucfirst($this->getName()); if ($fq) { $className = $this->parent->getNamespace() . '\\Document\\' . $className; } return $className; }
/** * Delete everything out of our testing database. */ public static function tearDownAfterClass() { parent::tearDownAfterClass(); \Definition::truncate(); \CsvDefinition::truncate(); \InstalledDefinition::truncate(); \JsonDefinition::truncate(); \ShpDefinition::truncate(); \SparqlDefinition::truncate(); \XlsDefinition::truncate(); \XmlDefinition::truncate(); \GeoProperty::truncate(); \TabularColumns::truncate(); \Geoprojection::truncate(); }
public function testDeleteApi() { // Delete the published definition for each test json file. foreach ($this->test_data as $file) { $this->updateRequest('DELETE'); $controller = \App::make('Tdt\\Core\\Definitions\\DefinitionController'); $response = $controller->handle("json/{$file}"); $this->assertEquals(200, $response->getStatusCode()); } // Check if everything is deleted properly. $definitions_count = \Definition::all()->count(); $json_count = \JsonDefinition::all()->count(); $this->assertTrue($json_count == 0); $this->assertTrue($definitions_count == 0); }
/** * Seed the JSON definitions */ private function seedJson() { // The json file names $json_data = array('crime' => 'Crime data from the uk.'); $added = false; foreach ($json_data as $file => $description) { // Don't create doubles $definition = Definition::where('collection_uri', '=', 'json')->where('resource_name', '=', $file)->first(); if (empty($definition)) { // Create a new JsonDefinition $json_def = new JsonDefinition(); $json_def->uri = 'file://' . app_path() . '/storage/data/json/' . $file . '.json'; $json_def->description = $description; $json_def->save(); // Add the JsonDefinition to the Definition $definition = new Definition(); $definition->collection_uri = 'json'; $definition->resource_name = $file; $definition->source_id = $json_def->id; $definition->source_type = 'JsonDefinition'; $definition->draft = false; $definition->save(); $this->command->info("Published a JSON file, {$file}, on uri (relative to the root) json/{$file} ."); $added = true; } } if (!$added) { $this->command->info("No JSON files have been published, all of the uri's that the JSON seeder wanted to use are already taken."); } }