From e5268e9707293d257816dc0b0ab6946349933acf Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Fri, 29 May 2020 13:26:26 +0100 Subject: [PATCH] Add the Config class Add a Config class for storing configuration values such as the Glassboxx username, password and vendor ID. --- .gitignore | 2 ++ composer.json | 15 ++++++++++++- src/Glassboxx/Config.php | 40 ++++++++++++++++++++++++++++++++++ tests/Glassboxx/ConfigTest.php | 22 +++++++++++++++++++ 4 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 src/Glassboxx/Config.php create mode 100644 tests/Glassboxx/ConfigTest.php diff --git a/.gitignore b/.gitignore index 96bcd18..957c926 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ !*/ !/.gitignore !/composer.json +!/src/** +!/tests/** diff --git a/composer.json b/composer.json index 484a161..06dfd74 100644 --- a/composer.json +++ b/composer.json @@ -9,5 +9,18 @@ } ], "minimum-stability": "stable", - "require": {} + "require": {}, + "autoload": { + "psr-4": { + "Opdavies\\Glassboxx\\": "src/Glassboxx/" + } + }, + "autoload-dev": { + "psr-4": { + "Opdavies\\Glassboxx\\Tests\\": "tests/" + } + }, + "require-dev": { + "phpunit/phpunit": "^9.1" + } } diff --git a/src/Glassboxx/Config.php b/src/Glassboxx/Config.php new file mode 100644 index 0000000..68f297c --- /dev/null +++ b/src/Glassboxx/Config.php @@ -0,0 +1,40 @@ +password = $password; + $this->username = $username; + $this->vendorId = $vendorId; + } + + public function getPassword(): string + { + return $this->password; + } + + public function getUsername(): string + { + return $this->username; + } + + public function getVendorId(): int + { + return $this->vendorId; + } +} diff --git a/tests/Glassboxx/ConfigTest.php b/tests/Glassboxx/ConfigTest.php new file mode 100644 index 0000000..2fea320 --- /dev/null +++ b/tests/Glassboxx/ConfigTest.php @@ -0,0 +1,22 @@ +assertSame(12345, $config->getVendorId()); + $this->assertSame('opdavies', $config->getUsername()); + $this->assertSame('secret', $config->getPassword()); + } +}