diff --git a/Tests/Utilities/ReturnHelperTest.php b/Tests/Utilities/ReturnHelperTest.php index 21c2446..f01d7eb 100644 --- a/Tests/Utilities/ReturnHelperTest.php +++ b/Tests/Utilities/ReturnHelperTest.php @@ -1,73 +1,75 @@ -getMessages()), "ReturnHelper returns the correct number of messages"); - self::assertFalse($ret->hasMessages(), "ReturnHelper notes absence of messages correctly"); - - $ret->addMessage("Testing"); - self::assertEquals(1, count($ret->getMessages()), "ReturnHelper returns the correct number of messages"); - - $ret->addMessages(array( - "Testing2", - "Testing3" - )); - self::assertEquals(3, count($ret->getMessages()), "ReturnHelper returns the correct number of messages"); - self::assertTrue($ret->hasMessages(), "ReturnHelper notes presence of messages correctly"); - self::assertArraySubset(array("Testing", "Testing2", "Testing3"), $ret->getMessages(), true, "ReturnHelper returns the correct messages"); - - try { - $ret->addMessages([]); - self::assertTrue(false); - } catch (\InvalidArgumentException $ex) { - self::assertEquals("Messages array to ReturnHelper::addMessages() must be array with elements", $ex->getMessage()); - } - - return; - } - - public function test_ResultHandling() { - $ret = new ReturnHelper(); - self::assertEquals(0, count($ret->getResults()), "ReturnHelper returns the correct number of results"); - self::assertFalse($ret->hasResults(), "ReturnHelper notes absence of results correctly"); - - $ret->addResult("Testing"); - self::assertEquals(1, count($ret->getResults()), "ReturnHelper returns the correct number of results"); - - $ret->addResults(array( - "Testing2", - "Testing3" - )); - self::assertEquals(3, count($ret->getResults()), "ReturnHelper returns the correct number of results"); - self::assertTrue($ret->hasResults(), "ReturnHelper notes presence of results correctly"); - self::assertArraySubset(array("Testing", "Testing2", "Testing3"), $ret->getResults(), true, "ReturnHelper returns the correct results"); - - try { - $ret->addResults([]); - self::assertTrue(false); - } catch (\InvalidArgumentException $ex) { - self::assertEquals("Results array to ReturnHelper::addResults() must be array with elements", $ex->getMessage()); - } - - return; - } - - public function test_GoodVsBad() { - $ret = new ReturnHelper(); - self::assertTrue($ret->isBad(), "ReturnHelper initializes as STATUS_BAD"); - - $ret->makeGood(); - self::assertTrue($ret->isGood(), "ReturnHelper is made STATUS_GOOD"); - - $ret->makeBad(); - self::assertTrue($ret->isBad(), "ReturnHelper is made STATUS_BAD"); - - return; - } - } +getMessages()), "ReturnHelper returns the correct number of messages"); + self::assertFalse($ret->hasMessages(), "ReturnHelper notes absence of messages correctly"); + + $ret->addMessage("Testing"); + self::assertEquals(1, count($ret->getMessages()), "ReturnHelper returns the correct number of messages"); + + $ret->addMessages(["Testing2", "Testing3"]); + self::assertEquals(3, count($ret->getMessages()), "ReturnHelper returns the correct number of messages"); + self::assertTrue($ret->hasMessages(), "ReturnHelper notes presence of messages correctly"); + + $messages = $ret->getMessages(); + self::assertEquals("Testing", $messages[0], "ReturnHelper returned the correct messages"); + self::assertEquals("Testing2", $messages[1], "ReturnHelper returned the correct messages"); + self::assertEquals("Testing3", $messages[2], "ReturnHelper returned the correct messages"); + + try { + $ret->addMessages([]); + self::assertTrue(false); + } catch (\InvalidArgumentException $ex) { + self::assertEquals("Messages array to ReturnHelper::addMessages() must be array with elements", $ex->getMessage()); + } + + return; + } + + public function test_ResultHandling() { + $ret = new ReturnHelper(); + self::assertEquals(0, count($ret->getResults()), "ReturnHelper returns the correct number of results"); + self::assertFalse($ret->hasResults(), "ReturnHelper notes absence of results correctly"); + + $ret->addResult("Testing"); + self::assertEquals(1, count($ret->getResults()), "ReturnHelper returns the correct number of results"); + + $ret->addResults(["Testing2", "Testing3"]); + self::assertEquals(3, count($ret->getResults()), "ReturnHelper returns the correct number of results"); + self::assertTrue($ret->hasResults(), "ReturnHelper notes presence of results correctly"); + + $results = $ret->getResults(); + self::assertEquals("Testing", $results[0], "ReturnHelper returned the correct messages"); + self::assertEquals("Testing2", $results[1], "ReturnHelper returned the correct messages"); + self::assertEquals("Testing3", $results[2], "ReturnHelper returned the correct messages"); + + try { + $ret->addResults([]); + self::assertTrue(false); + } catch (\InvalidArgumentException $ex) { + self::assertEquals("Results array to ReturnHelper::addResults() must be array with elements", $ex->getMessage()); + } + + return; + } + + public function test_GoodVsBad() { + $ret = new ReturnHelper(); + self::assertTrue($ret->isBad(), "ReturnHelper initializes as STATUS_BAD"); + + $ret->makeGood(); + self::assertTrue($ret->isGood(), "ReturnHelper is made STATUS_GOOD"); + + $ret->makeBad(); + self::assertTrue($ret->isBad(), "ReturnHelper is made STATUS_BAD"); + + return; + } + } diff --git a/composer.json b/composer.json index 697c928..b6e9b7c 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "stoic/stoic", "description": "Stoic framework Core component", - "version": "1.0.1", + "version": "1.0.2", "homepage": "https://stoic-framework.com", "autoload": { "psr-0": { @@ -19,11 +19,11 @@ ] }, "require": { - "php": "^7.0", + "php": ">=7.4", "psr/log": "^1.0.0" }, "require-dev": { - "phpunit/phpunit": "^7" + "phpunit/phpunit": "^9" }, "provide": { "psr/log-implementation": "1.0.0" diff --git a/phpunit.xml b/phpunit.xml index 483b6d5..0e2b1b1 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,39 +1,31 @@ - - - - - - - - ./Tests/Chain/ - - - ./Tests/Log/ - - - ./Tests/Utilities/ - - - - - ./Chain - ./Log - ./Utilities - - - - - - - - \ No newline at end of file + + + + ./Chain + ./Log + ./Utilities + + + + + + + + + + + + ./Tests/Chain/ + + + ./Tests/Log/ + + + ./Tests/Utilities/ + + + + + +