/** * simple test to get an environment variable. * * @expecteException RuntimeException */ public function testCanGetEnvironment() { $env1 = $_ENV['APPLICATION_NAME']; $env2 = Ev::get('APPLICATION_NAME'); $this->assertEquals($env1, $env2); $this->assertEquals('test', Ev::get('no_exist', 'test')); }
public function testCanCreateBaseFromOptionsArray() { $options = ['id' => "anID", 'baseUrl' => 'http://options.com/', 'basePath' => 'oops/', 'documentationUrl' => Ev::get('API_BASE_URL'), 'version' => 'v2.0', 'description' => 'created from array']; $app = new JSONSchemaAppliance($options); $this->assertTrue($app->allSet()); $schema = $app->toSchema(); $this->assertEquals($schema['basePath'], $options['basePath']); $this->assertEquals($schema['baseUrl'], $options['baseUrl']); $this->assertEquals($schema['version'], $options['version']); }
/** * * @param array $options */ public function constructBase(array $options = null) { if (!isset($this->base)) { $this->base = new Base(); } $this->base->setBaseUrl(isset($options['baseUrl']) ? $options['baseUrl'] : Ev::get('API_BASE_URL')); $this->base->setBasePath(isset($options['basePath']) ? $options['basePath'] : Ev::get('API_BASE_PATH')); $this->base->setDocumentationUrl(isset($options['documentationUrl']) ? $options['documentationUrl'] : Ev::get('API_DOCUMENTATION_URL')); $this->base->setName(isset($options['applicationName']) ? $options['applicationName'] : Ev::get('APPLICATION_NAME')); $this->base->setId(isset($options['id']) ? $options['id'] : Ev::get('APPLICATION_NAME') . ":" . Ev::get('API_VERSION')); $this->base->setVersion(isset($options['version']) ? $options['version'] : Ev::get('API_VERSION')); $this->base->setDescription(isset($options['description']) ? $options['description'] : Ev::get('API_DESCRIPTION')); }