From 4a873ee2c285e7f57f6fe6362f98e5fac5f26579 Mon Sep 17 00:00:00 2001 From: Jordan Hall Date: Thu, 11 Jan 2018 10:44:05 +0000 Subject: [PATCH] Basic usage test --- composer.json | 3 +++ phpunit.xml | 25 +++++++++++++++++++++++++ src/example.php | 2 +- tests/Functional/BasicUsageTest.php | 26 ++++++++++++++++++++++++++ tests/Unit/.keep | 0 5 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 phpunit.xml create mode 100644 tests/Functional/BasicUsageTest.php create mode 100644 tests/Unit/.keep diff --git a/composer.json b/composer.json index 33b22c5..4464e00 100755 --- a/composer.json +++ b/composer.json @@ -13,6 +13,9 @@ "php": ">=5.3", "rapidwebltd/rw-file-cache": "^1.0" }, + "require-dev": { + "phpunit/phpunit": "^5.7" + }, "autoload": { "psr-4": { "RapidWeb\\UkBankHolidays\\": "./src/" diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..0da065c --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,25 @@ + + + + + ./tests/Unit + + + ./tests/Functional + + + + + + + + + \ No newline at end of file diff --git a/src/example.php b/src/example.php index 0dbc180..9174fa5 100755 --- a/src/example.php +++ b/src/example.php @@ -1,5 +1,5 @@ assertTrue(is_array($holidays), 'Holidays should be an array.'); + $this->assertEquals(1, count($holidays), 'Holidays array should have 1 value.'); + + $holiday = $holidays[0]; + + $this->assertEquals('RapidWeb\UkBankHolidays\Objects\UkBankHoliday', get_class($holiday)); + + $this->assertEquals('New Year’s Day', $holiday->title); + $this->assertEquals('2017-01-02', $holiday->date); + $this->assertEquals('Substitute day', $holiday->notes); + + } + +} \ No newline at end of file diff --git a/tests/Unit/.keep b/tests/Unit/.keep new file mode 100644 index 0000000..e69de29