From e850c1db04252330788606c6ac59cf949b34c4d2 Mon Sep 17 00:00:00 2001 From: Netkas Date: Thu, 23 Sep 2021 20:02:50 -0400 Subject: [PATCH] Various bug fixes --- src/acm2/acm2.php | 6 ++++-- src/acm2/package.json | 4 +++- tests/configuration_test.php | 22 ++++++++++++++++++++++ 3 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 tests/configuration_test.php diff --git a/src/acm2/acm2.php b/src/acm2/acm2.php index ab6fd11..777141d 100644 --- a/src/acm2/acm2.php +++ b/src/acm2/acm2.php @@ -42,11 +42,13 @@ $vendor = strtolower($vendor); $this->VendorName = $vendor; - $this->WorkingDirectory = DIRECTORY_SEPARATOR . 'var' . DIRECTORY_SEPARATOR . 'acm'; + $this->WorkingDirectory = DIRECTORY_SEPARATOR . 'etc' . DIRECTORY_SEPARATOR . 'acm'; $this->MasterConfigurationPath = $this->WorkingDirectory . DIRECTORY_SEPARATOR . $this->VendorName . '.json'; if(file_exists($this->WorkingDirectory) == false) throw new ConfigurationFolderNotFoundException('The configuration folder \'' . $this->WorkingDirectory . '\' was not found'); + + $this->reloadConfiguration(); } /** @@ -69,7 +71,7 @@ return; } - $this->Configuration = json_decode(file_get_contents($this->MasterConfigurationPath)); + $this->Configuration = json_decode(file_get_contents($this->MasterConfigurationPath), true); } /** diff --git a/src/acm2/package.json b/src/acm2/package.json index 29b3238..1937ed1 100644 --- a/src/acm2/package.json +++ b/src/acm2/package.json @@ -33,5 +33,7 @@ "file": "Objects/Schema.php" } ], - "files": [] + "files": [ + "package.json" + ] } \ No newline at end of file diff --git a/tests/configuration_test.php b/tests/configuration_test.php new file mode 100644 index 0000000..0c9caba --- /dev/null +++ b/tests/configuration_test.php @@ -0,0 +1,22 @@ +setName('Database'); + $schema->setDefinition('Driver', 'MySQL'); + $schema->setDefinition('Host', '127.0.0.1'); + $schema->setDefinition('Host2', '127.0.0.2'); + $schema->setDefinition('Port', 12345); + $schema->setDefinition('AuthenticationMethods', [ + 'foo' => 'bar', + 'username' => 'password' + ]); + + $acm->defineSchema($schema); + + var_dump($acm->getConfiguration('Database')); \ No newline at end of file