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