Skip to content

Commit

Permalink
Add some more test cases (webmozarts#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
BackEndTea authored Jun 24, 2019
1 parent d8fe7cc commit c21b45e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/AssertTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,10 @@ public function getTests()
array('startsWith', array('abcd', 'bc'), false),
array('startsWith', array('', 'bc'), false),
array('startsWithLetter', array('abcd'), true),
array('startsWithLetter', array('a'), true),
array('startsWithLetter', array('a1'), true),
array('startsWithLetter', array('1abcd'), false),
array('startsWithLetter', array('1'), false),
array('startsWithLetter', array(''), false),
array('endsWith', array('abcd', 'cd'), true),
array('endsWith', array('abcd', 'bc'), false),
Expand Down Expand Up @@ -335,17 +338,23 @@ public function getTests()
array('maxCount', array(array(0, 1), 2), true),
array('maxCount', array(array(0), 2), true),
array('countBetween', array(array(0, 1, 2), 4, 5), false),
array('countBetween', array(array(0, 1, 2), 3, 5), true),
array('countBetween', array(array(0, 1, 2), 1, 2), false),
array('countBetween', array(array(0, 1, 2), 2, 5), true),
array('countBetween', array(array(0, 1, 2), 2, 3), true),
array('isList', array(array(1, 2, 3)), true),
array('isList', array(array()), false),
array('isList', array(array(0 => 1, 2 => 3)), false),
array('isList', array(array('key' => 1, 'foo' => 2)), false),
array('isList', array(true), false),
array('isList', array(false), false),
array('isMap', array(array('key' => 1, 'foo' => 2)), true),
array('isMap', array(array()), false),
array('isMap', array(array(1, 2, 3)), false),
array('isMap', array(array(0 => 1, 2 => 3)), false),
array('uuid', array('00000000-0000-0000-0000-000000000000'), true),
array('uuid', array('urn:ff6f8cb0-c57d-21e1-9b21-0800200c9a66'), true),
array('uuid', array('uuid:{ff6f8cb0-c57d-21e1-9b21-0800200c9a66}'), true),
array('uuid', array('ff6f8cb0-c57d-21e1-9b21-0800200c9a66'), true),
array('uuid', array('ff6f8cb0-c57d-11e1-9b21-0800200c9a66'), true),
array('uuid', array('ff6f8cb0-c57d-31e1-9b21-0800200c9a66'), true),
Expand Down Expand Up @@ -546,6 +555,13 @@ public function testConvertValuesToStrings($method, $args, $exceptionMessage)

call_user_func_array(array('Webmozart\Assert\Assert', $method), $args);
}

public function testAnUnkownMethodThrowsABadMethodCall()
{
$this->setExpectedException('\BadMethodCallException');

Assert::nonExistentMethod();
}
}

/**
Expand Down

0 comments on commit c21b45e

Please sign in to comment.