Complex classes like AssertTest often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use AssertTest, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 20 | class AssertTest extends \PHPUnit_Framework_TestCase |
||
| 21 | { |
||
| 22 | public static function dataInvalidFloat() |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @dataProvider dataInvalidFloat |
||
| 36 | */ |
||
| 37 | public function testInvalidFloat($nonFloat) |
||
| 42 | |||
| 43 | public function testValidFloat() |
||
| 49 | |||
| 50 | public static function dataInvalidInteger() |
||
| 51 | { |
||
| 52 | return array( |
||
| 53 | array(1.23), |
||
| 54 | array(false), |
||
| 55 | array("test"), |
||
| 56 | array(null), |
||
| 57 | array("1.23"), |
||
| 58 | array("10"), |
||
| 59 | array(new \DateTime()), |
||
| 60 | ); |
||
| 61 | } |
||
| 62 | |||
| 63 | /** |
||
| 64 | * @dataProvider dataInvalidInteger |
||
| 65 | */ |
||
| 66 | public function testInvalidInteger($nonInteger) |
||
| 71 | |||
| 72 | public function testValidInteger() |
||
| 77 | |||
| 78 | public function testValidIntegerish() |
||
| 83 | |||
| 84 | public static function dataInvalidIntegerish() |
||
| 94 | |||
| 95 | /** |
||
| 96 | * @dataProvider dataInvalidIntegerish |
||
| 97 | */ |
||
| 98 | public function testInvalidIntegerish($nonInteger) |
||
| 103 | |||
| 104 | public function testValidBoolean() |
||
| 109 | |||
| 110 | public function testInvalidBoolean() |
||
| 115 | |||
| 116 | public function testInvalidScalar() |
||
| 117 | { |
||
| 118 | $this->setExpectedException('Assert\AssertionFailedException', null, Assertion::INVALID_SCALAR); |
||
| 119 | Assertion::scalar(new \stdClass); |
||
| 120 | } |
||
| 121 | |||
| 122 | public function testValidScalar() |
||
| 123 | { |
||
| 124 | $this->assertTrue(Assertion::scalar("foo")); |
||
| 125 | $this->assertTrue(Assertion::scalar(52)); |
||
| 126 | $this->assertTrue(Assertion::scalar(12.34)); |
||
| 127 | $this->assertTrue(Assertion::scalar(false)); |
||
| 128 | } |
||
| 129 | |||
| 130 | public static function dataInvalidNotEmpty() |
||
| 140 | |||
| 141 | /** |
||
| 142 | * @dataProvider dataInvalidNotEmpty |
||
| 143 | */ |
||
| 144 | public function testInvalidNotEmpty($value) |
||
| 149 | |||
| 150 | public function testNotEmpty() |
||
| 157 | |||
| 158 | public function testEmpty() |
||
| 165 | |||
| 166 | public static function dataInvalidEmpty() |
||
| 176 | |||
| 177 | /** |
||
| 178 | * @dataProvider dataInvalidEmpty |
||
| 179 | */ |
||
| 180 | public function testInvalidEmpty($value) |
||
| 185 | |||
| 186 | public static function dataInvalidNull() |
||
| 197 | |||
| 198 | /** |
||
| 199 | * @dataProvider dataInvalidNull |
||
| 200 | */ |
||
| 201 | public function testInvalidNull($value) |
||
| 206 | |||
| 207 | public function testNull() |
||
| 211 | |||
| 212 | public function testNotNull() |
||
| 220 | |||
| 221 | public function testInvalidNotNull() |
||
| 226 | |||
| 227 | public function testString() |
||
| 232 | |||
| 233 | /** |
||
| 234 | * @dataProvider dataInvalidString |
||
| 235 | */ |
||
| 236 | public function testInvalidString($invalidString) |
||
| 241 | |||
| 242 | public static function dataInvalidString() |
||
| 253 | |||
| 254 | public function testValidRegex() |
||
| 258 | |||
| 259 | public function testInvalidRegex() |
||
| 264 | |||
| 265 | public function testInvalidRegexValueNotString() |
||
| 270 | |||
| 271 | public function testInvalidMinLength() |
||
| 276 | |||
| 277 | public function testValidMinLength() |
||
| 285 | |||
| 286 | public function testInvalidMaxLength() |
||
| 291 | |||
| 292 | public function testValidMaxLength() |
||
| 299 | |||
| 300 | public function testInvalidBetweenLengthMin() |
||
| 305 | |||
| 306 | public function testInvalidBetweenLengthMax() |
||
| 311 | |||
| 312 | public function testValidBetweenLength() |
||
| 317 | |||
| 318 | public function testInvalidStartsWith() |
||
| 323 | |||
| 324 | public function testInvalidStartsWithDueToWrongEncoding() |
||
| 329 | |||
| 330 | public function testValidStartsWith() |
||
| 337 | |||
| 338 | public function testInvalidEndsWith() |
||
| 343 | |||
| 344 | public function testInvalidEndsWithDueToWrongEncoding() |
||
| 349 | |||
| 350 | public function testValidEndsWith() |
||
| 357 | |||
| 358 | public function testInvalidContains() |
||
| 363 | |||
| 364 | public function testValidContains() |
||
| 369 | |||
| 370 | public function testInvalidChoice() |
||
| 375 | |||
| 376 | public function testValidChoice() |
||
| 380 | |||
| 381 | public function testInvalidInArray() |
||
| 386 | |||
| 387 | public function testValidInArray() |
||
| 391 | |||
| 392 | public function testInvalidNumeric() |
||
| 397 | |||
| 398 | public function testValidNumeric() |
||
| 404 | |||
| 405 | public static function dataInvalidArray() |
||
| 417 | |||
| 418 | /** |
||
| 419 | * @dataProvider dataInvalidArray |
||
| 420 | */ |
||
| 421 | public function testInvalidArray($value) |
||
| 426 | |||
| 427 | public function testValidArray() |
||
| 433 | |||
| 434 | public function testInvalidKeyExists() |
||
| 439 | |||
| 440 | public function testValidKeyExists() |
||
| 444 | |||
| 445 | public function testInvalidKeyNotExists() |
||
| 450 | |||
| 451 | public function testValidKeyNotExists() |
||
| 455 | |||
| 456 | public static function dataInvalidNotBlank() |
||
| 457 | { |
||
| 458 | return array( |
||
| 459 | array(""), |
||
| 460 | array(" "), |
||
| 461 | array("\t"), |
||
| 462 | array("\n"), |
||
| 463 | array("\r"), |
||
| 464 | array(false), |
||
| 465 | array(null), |
||
| 466 | array( array() ), |
||
| 467 | ); |
||
| 468 | } |
||
| 469 | |||
| 470 | /** |
||
| 471 | * @dataProvider dataInvalidNotBlank |
||
| 472 | */ |
||
| 473 | public function testInvalidNotBlank($notBlank) |
||
| 474 | { |
||
| 475 | $this->setExpectedException('Assert\AssertionFailedException', null, Assertion::INVALID_NOT_BLANK); |
||
| 476 | Assertion::notBlank($notBlank); |
||
| 477 | } |
||
| 478 | |||
| 479 | public function testValidNotBlank() |
||
| 483 | |||
| 484 | public function testInvalidNotInstanceOf() |
||
| 489 | |||
| 490 | public function testValidNotIsInstanceOf() |
||
| 494 | |||
| 495 | public function testInvalidInstanceOf() |
||
| 500 | |||
| 501 | public function testValidInstanceOf() |
||
| 505 | |||
| 506 | public function testInvalidSubclassOf() |
||
| 511 | |||
| 512 | public function testValidSubclassOf() |
||
| 516 | |||
| 517 | public function testInvalidRange() |
||
| 523 | |||
| 524 | public function testValidRange() |
||
| 531 | |||
| 532 | public function testInvalidEmail() |
||
| 537 | |||
| 538 | public function testValidEmail() |
||
| 542 | |||
| 543 | /** |
||
| 544 | * @dataProvider dataInvalidUrl |
||
| 545 | */ |
||
| 546 | public function testInvalidUrl($url) |
||
| 552 | |||
| 553 | public static function dataInvalidUrl() |
||
| 575 | |||
| 576 | /** |
||
| 577 | * @dataProvider dataValidUrl |
||
| 578 | */ |
||
| 579 | public function testValidUrl($url) |
||
| 583 | |||
| 584 | public static function dataValidUrl() |
||
| 644 | |||
| 645 | public function testInvalidDigit() |
||
| 650 | |||
| 651 | public function testValidDigit() |
||
| 657 | |||
| 658 | public function testValidAlnum() |
||
| 665 | |||
| 666 | public function testInvalidAlnum() |
||
| 671 | |||
| 672 | public function testValidTrue() |
||
| 676 | |||
| 677 | public function testInvalidTrue() |
||
| 682 | |||
| 683 | public function testValidFalse() |
||
| 687 | |||
| 688 | public function testInvalidFalse() |
||
| 693 | |||
| 694 | public function testInvalidClass() |
||
| 699 | |||
| 700 | public function testValidClass() |
||
| 704 | |||
| 705 | public function testSame() |
||
| 713 | |||
| 714 | public function testEq() |
||
| 722 | |||
| 723 | public function testNotEq() |
||
| 730 | |||
| 731 | public function testNotSame() |
||
| 738 | |||
| 739 | public function testNotInArray() |
||
| 747 | |||
| 748 | public function testMin() |
||
| 770 | |||
| 771 | public function testMax() |
||
| 793 | |||
| 794 | public function testNullOr() |
||
| 799 | |||
| 800 | public function testNullOrWithNoValueThrows() |
||
| 805 | |||
| 806 | public function testLength() |
||
| 811 | |||
| 812 | public static function dataLengthUtf8Characters() |
||
| 819 | |||
| 820 | /** |
||
| 821 | * @dataProvider dataLengthUtf8Characters |
||
| 822 | */ |
||
| 823 | public function testLengthUtf8Characters($value, $expected) |
||
| 824 | { |
||
| 825 | $this->assertTrue(Assertion::length($value, $expected)); |
||
| 826 | } |
||
| 827 | |||
| 828 | public function testLengthFailed() |
||
| 833 | |||
| 834 | public function testLengthFailedForWrongEncoding() |
||
| 839 | |||
| 840 | public function testLengthValidForGivenEncoding() |
||
| 844 | |||
| 845 | public function testFile() |
||
| 849 | |||
| 850 | public function testFileWithEmptyFilename() |
||
| 855 | |||
| 856 | public function testFileDoesNotExists() |
||
| 861 | |||
| 862 | public function testDirectory() |
||
| 869 | |||
| 870 | public function testReadable() |
||
| 877 | |||
| 878 | public function testWriteable() |
||
| 885 | |||
| 886 | /** |
||
| 887 | * @expectedException \BadMethodCallException |
||
| 888 | * @expectedExceptionMessage No assertion |
||
| 889 | */ |
||
| 890 | public function testFailedNullOrMethodCall() |
||
| 894 | |||
| 895 | public function testImplementsInterface() |
||
| 908 | |||
| 909 | public function testImplementsInterfaceWithClassObject() |
||
| 924 | |||
| 925 | /** |
||
| 926 | * @dataProvider isJsonStringDataprovider |
||
| 927 | */ |
||
| 928 | public function testIsJsonString($content) |
||
| 932 | |||
| 933 | public static function isJsonStringDataprovider() |
||
| 942 | |||
| 943 | /** |
||
| 944 | * @dataProvider isJsonStringInvalidStringDataprovider |
||
| 945 | */ |
||
| 946 | public function testIsJsonStringExpectingException($invalidString) |
||
| 951 | |||
| 952 | public static function isJsonStringInvalidStringDataprovider() |
||
| 959 | |||
| 960 | /** |
||
| 961 | * @dataProvider providesValidUuids |
||
| 962 | */ |
||
| 963 | public function testValidUuids($uuid) |
||
| 967 | |||
| 968 | /** |
||
| 969 | * @dataProvider providesInvalidUuids |
||
| 970 | */ |
||
| 971 | public function testInvalidUuids($uuid) |
||
| 976 | |||
| 977 | public static function providesValidUuids() |
||
| 988 | |||
| 989 | public static function providesInvalidUuids() |
||
| 999 | |||
| 1000 | /** |
||
| 1001 | * @dataProvider providesValidE164s |
||
| 1002 | */ |
||
| 1003 | public function testValidE164s($e164) |
||
| 1007 | |||
| 1008 | /** |
||
| 1009 | * @dataProvider providesInvalidE164s |
||
| 1010 | */ |
||
| 1011 | public function testInvalidE164s($e164) |
||
| 1016 | |||
| 1017 | public static function providesValidE164s() |
||
| 1025 | |||
| 1026 | public static function providesInvalidE164s() |
||
| 1033 | |||
| 1034 | public function testValidNotEmptyKey() |
||
| 1038 | |||
| 1039 | /** |
||
| 1040 | * @dataProvider invalidNotEmptyKeyDataprovider |
||
| 1041 | */ |
||
| 1042 | public function testInvalidNotEmptyKey($invalidArray, $key) |
||
| 1047 | |||
| 1048 | public static function invalidNotEmptyKeyDataprovider() |
||
| 1055 | |||
| 1056 | public function testAllWithSimpleAssertion() |
||
| 1060 | |||
| 1061 | public function testAllWithSimpleAssertionThrowsExceptionOnElementThatFailsAssertion() |
||
| 1066 | |||
| 1067 | public function testAllWithComplexAssertion() |
||
| 1071 | |||
| 1072 | public function testAllWithComplexAssertionThrowsExceptionOnElementThatFailsAssertion() |
||
| 1078 | |||
| 1079 | public function testAllWithNoValueThrows() |
||
| 1084 | |||
| 1085 | public function testValidCount() |
||
| 1090 | |||
| 1091 | public static function dataInvalidCount() |
||
| 1098 | |||
| 1099 | /** |
||
| 1100 | * @dataProvider dataInvalidCount |
||
| 1101 | */ |
||
| 1102 | public function testInvalidCount($countable, $count) |
||
| 1107 | |||
| 1108 | public function testChoicesNotEmpty() |
||
| 1115 | |||
| 1116 | /** |
||
| 1117 | * @dataProvider invalidChoicesProvider |
||
| 1118 | */ |
||
| 1119 | public function testChoicesNotEmptyExpectingException($values, $choices, $exceptionCode) |
||
| 1127 | |||
| 1128 | public function invalidChoicesProvider() |
||
| 1136 | |||
| 1137 | public function testIsObject() |
||
| 1141 | |||
| 1142 | public function testIsObjectExpectingException() |
||
| 1147 | |||
| 1148 | public function testMethodExists() |
||
| 1152 | |||
| 1153 | public function testMethodExistsFailure() |
||
| 1158 | |||
| 1159 | /** |
||
| 1160 | * @test |
||
| 1161 | */ |
||
| 1162 | public function it_passes_values_and_constraints_to_exception() |
||
| 1173 | |||
| 1174 | public function testLessThan() |
||
| 1175 | { |
||
| 1176 | $this->assertTrue(Assertion::lessThan(1, 2)); |
||
| 1177 | $this->assertTrue(Assertion::lessThan('aaa', 'bbb')); |
||
| 1178 | $this->assertTrue(Assertion::lessThan('aaa', 'aaaa')); |
||
| 1179 | $this->assertTrue(Assertion::lessThan(new \DateTime('today'), new \DateTime('tomorrow'))); |
||
| 1180 | } |
||
| 1181 | |||
| 1182 | public function invalidLessProvider() |
||
| 1183 | { |
||
| 1184 | return array( |
||
| 1185 | array(2, 1), |
||
| 1186 | array(2, 2), |
||
| 1187 | array('aaa', 'aaa'), |
||
| 1188 | array('aaaa', 'aaa'), |
||
| 1189 | array(new \DateTime('today'), new \DateTime('yesterday')), |
||
| 1190 | array(new \DateTime('today'), new \DateTime('today')), |
||
| 1191 | ); |
||
| 1192 | } |
||
| 1193 | |||
| 1194 | /** |
||
| 1195 | * @dataProvider invalidLessProvider |
||
| 1196 | */ |
||
| 1197 | public function testLessThanThrowsException($value, $limit) |
||
| 1198 | { |
||
| 1199 | $this->setExpectedException('Assert\AssertionFailedException', null, Assertion::INVALID_LESS); |
||
| 1200 | Assertion::lessThan($value, $limit); |
||
| 1201 | } |
||
| 1202 | |||
| 1203 | public function testLessOrEqualThan() |
||
| 1204 | { |
||
| 1205 | $this->assertTrue(Assertion::lessOrEqualThan(1, 2)); |
||
| 1206 | $this->assertTrue(Assertion::lessOrEqualThan(1, 1)); |
||
| 1207 | $this->assertTrue(Assertion::lessOrEqualThan('aaa', 'bbb')); |
||
| 1208 | $this->assertTrue(Assertion::lessOrEqualThan('aaa', 'aaaa')); |
||
| 1209 | $this->assertTrue(Assertion::lessOrEqualThan('aaa', 'aaa')); |
||
| 1210 | $this->assertTrue(Assertion::lessOrEqualThan(new \DateTime('today'), new \DateTime('tomorrow'))); |
||
| 1211 | $this->assertTrue(Assertion::lessOrEqualThan(new \DateTime('today'), new \DateTime('today'))); |
||
| 1212 | } |
||
| 1213 | |||
| 1214 | public function invalidLessOrEqualProvider() |
||
| 1215 | { |
||
| 1216 | return array( |
||
| 1217 | array(2, 1), |
||
| 1218 | array('aaaa', 'aaa'), |
||
| 1219 | array(new \DateTime('today'), new \DateTime('yesterday')), |
||
| 1220 | ); |
||
| 1221 | } |
||
| 1222 | |||
| 1223 | /** |
||
| 1224 | * @dataProvider invalidLessOrEqualProvider |
||
| 1225 | */ |
||
| 1226 | public function testLessOrEqualThanThrowsException($value, $limit) |
||
| 1227 | { |
||
| 1228 | $this->setExpectedException('Assert\AssertionFailedException', null, Assertion::INVALID_LESS_OR_EQUAL); |
||
| 1229 | Assertion::lessOrEqualThan($value, $limit); |
||
| 1230 | } |
||
| 1231 | |||
| 1232 | public function testGreaterThan() |
||
| 1233 | { |
||
| 1234 | $this->assertTrue(Assertion::greaterThan(2, 1)); |
||
| 1235 | $this->assertTrue(Assertion::greaterThan('bbb', 'aaa')); |
||
| 1236 | $this->assertTrue(Assertion::greaterThan('aaaa', 'aaa')); |
||
| 1237 | $this->assertTrue(Assertion::greaterThan(new \DateTime('tomorrow'), new \DateTime('today'))); |
||
| 1238 | } |
||
| 1239 | |||
| 1240 | public function invalidGreaterProvider() |
||
| 1241 | { |
||
| 1242 | return array( |
||
| 1243 | array(1, 2), |
||
| 1244 | array(2, 2), |
||
| 1245 | array('aaa', 'aaa'), |
||
| 1246 | array('aaa', 'aaaa'), |
||
| 1247 | array(new \DateTime('yesterday'), new \DateTime('today')), |
||
| 1248 | array(new \DateTime('today'), new \DateTime('today')), |
||
| 1249 | ); |
||
| 1250 | } |
||
| 1251 | |||
| 1252 | /** |
||
| 1253 | * @dataProvider validDateProvider |
||
| 1254 | */ |
||
| 1255 | public function testValidDate($value, $format) |
||
| 1259 | |||
| 1260 | public function validDateProvider() |
||
| 1269 | |||
| 1270 | /** |
||
| 1271 | * @dataProvider invalidGreaterProvider |
||
| 1272 | */ |
||
| 1273 | public function testGreaterThanThrowsException($value, $limit) |
||
| 1274 | { |
||
| 1275 | $this->setExpectedException('Assert\AssertionFailedException', null, Assertion::INVALID_GREATER); |
||
| 1276 | Assertion::greaterThan($value, $limit); |
||
| 1277 | } |
||
| 1278 | |||
| 1279 | public function testGreaterOrEqualThan() |
||
| 1280 | { |
||
| 1281 | $this->assertTrue(Assertion::greaterOrEqualThan(2, 1)); |
||
| 1282 | $this->assertTrue(Assertion::greaterOrEqualThan(1, 1)); |
||
| 1283 | $this->assertTrue(Assertion::greaterOrEqualThan('bbb', 'aaa')); |
||
| 1284 | $this->assertTrue(Assertion::greaterOrEqualThan('aaaa', 'aaa')); |
||
| 1285 | $this->assertTrue(Assertion::greaterOrEqualThan('aaa', 'aaa')); |
||
| 1286 | $this->assertTrue(Assertion::greaterOrEqualThan(new \DateTime('tomorrow'), new \DateTime('today'))); |
||
| 1287 | $this->assertTrue(Assertion::greaterOrEqualThan(new \DateTime('today'), new \DateTime('today'))); |
||
| 1288 | } |
||
| 1289 | |||
| 1290 | public function invalidGreaterOrEqualProvider() |
||
| 1291 | { |
||
| 1292 | return array( |
||
| 1293 | array(1, 2), |
||
| 1294 | array('aaa', 'aaaa'), |
||
| 1295 | array(new \DateTime('yesterday'), new \DateTime('tomorrow')), |
||
| 1296 | ); |
||
| 1297 | } |
||
| 1298 | |||
| 1299 | /** |
||
| 1300 | * @dataProvider invalidGreaterOrEqualProvider |
||
| 1301 | * |
||
| 1302 | * @param mixed $value |
||
| 1303 | * @param mixed $limit |
||
| 1304 | */ |
||
| 1305 | public function testGreaterOrEqualThanThrowsException($value, $limit) |
||
| 1306 | { |
||
| 1307 | $this->setExpectedException('Assert\AssertionFailedException', null, Assertion::INVALID_GREATER_OR_EQUAL); |
||
| 1308 | Assertion::greaterOrEqualThan($value, $limit); |
||
| 1309 | } |
||
| 1310 | |||
| 1311 | /** |
||
| 1312 | * @dataProvider invalidDateProvider |
||
| 1313 | */ |
||
| 1314 | public function testInvalidDate($value, $format) |
||
| 1319 | |||
| 1320 | public function invalidDateProvider() |
||
| 1328 | |||
| 1329 | public function testValidTraversable() |
||
| 1333 | |||
| 1334 | public function testInvalidTraversable() |
||
| 1339 | |||
| 1340 | public function testValidArrayAccessible() |
||
| 1344 | |||
| 1345 | public function testInvalidArrayAccessible() |
||
| 1350 | |||
| 1351 | public function testInvalidCallable() |
||
| 1356 | |||
| 1357 | public function testValidCallable() |
||
| 1365 | |||
| 1366 | public function testInvalidSatisfy() |
||
| 1373 | |||
| 1374 | public function testValidSatisfy() |
||
| 1388 | |||
| 1389 | /** |
||
| 1390 | * @dataProvider validIpProvider |
||
| 1391 | */ |
||
| 1392 | public function testValidIp($value) |
||
| 1396 | |||
| 1397 | public function validIpProvider() |
||
| 1406 | |||
| 1407 | /** |
||
| 1408 | * @dataProvider invalidIpProvider |
||
| 1409 | */ |
||
| 1410 | public function testInvalidIp($value, $flag = null) |
||
| 1415 | |||
| 1416 | public function invalidIpProvider() |
||
| 1428 | |||
| 1429 | public function testValidIpv4() |
||
| 1433 | |||
| 1434 | public function testInvalidIpv4() |
||
| 1439 | |||
| 1440 | public function testValidIpv6() |
||
| 1444 | |||
| 1445 | public function testInvalidIpv6() |
||
| 1450 | |||
| 1451 | public function testInvalidInterfaceExists() |
||
| 1456 | |||
| 1457 | public function testValidInterfaceExists() |
||
| 1461 | |||
| 1462 | /** |
||
| 1463 | * @dataProvider providerInvalidBetween |
||
| 1464 | * |
||
| 1465 | * @param mixed $value |
||
| 1466 | * @param mixed $lowerLimit |
||
| 1467 | * @param mixed $upperLimit |
||
| 1468 | */ |
||
| 1469 | public function testInvalidBetween($value, $lowerLimit, $upperLimit) |
||
| 1475 | |||
| 1476 | /** |
||
| 1477 | * @return array |
||
| 1478 | */ |
||
| 1479 | public function providerInvalidBetween() |
||
| 1490 | |||
| 1491 | /** |
||
| 1492 | * @dataProvider providerValidBetween |
||
| 1493 | * |
||
| 1494 | * @param mixed $value |
||
| 1495 | * @param mixed $lowerLimit |
||
| 1496 | * @param mixed $upperLimit |
||
| 1497 | */ |
||
| 1498 | public function testValidBetween($value, $lowerLimit, $upperLimit) |
||
| 1502 | |||
| 1503 | /** |
||
| 1504 | * @return array |
||
| 1505 | */ |
||
| 1506 | public function providerValidBetween() |
||
| 1517 | |||
| 1518 | /** |
||
| 1519 | * @dataProvider providerInvalidBetweenExclusive |
||
| 1520 | * |
||
| 1521 | * @param mixed $value |
||
| 1522 | * @param mixed $lowerLimit |
||
| 1523 | * @param mixed $upperLimit |
||
| 1524 | */ |
||
| 1525 | public function testInvalidBetweenExclusive($value, $lowerLimit, $upperLimit) |
||
| 1531 | |||
| 1532 | /** |
||
| 1533 | * @return array |
||
| 1534 | */ |
||
| 1535 | public function providerInvalidBetweenExclusive() |
||
| 1546 | |||
| 1547 | /** |
||
| 1548 | * @dataProvider providerValidBetweenExclusive |
||
| 1549 | * |
||
| 1550 | * @param mixed $value |
||
| 1551 | * @param mixed $lowerLimit |
||
| 1552 | * @param mixed $upperLimit |
||
| 1553 | */ |
||
| 1554 | public function testValidBetweenExclusive($value, $lowerLimit, $upperLimit) |
||
| 1558 | |||
| 1559 | /** |
||
| 1560 | * @return array |
||
| 1561 | */ |
||
| 1562 | public function providerValidBetweenExclusive() |
||
| 1570 | |||
| 1571 | public function testStringifyTruncatesStringValuesLongerThan100CharactersAppropriately() |
||
| 1579 | |||
| 1580 | public function testStringifyReportsResourceType() |
||
| 1586 | |||
| 1587 | public function testExtensionLoaded() |
||
| 1588 | { |
||
| 1591 | |||
| 1592 | /** |
||
| 1593 | * @expectedException \Assert\InvalidArgumentException |
||
| 1594 | */ |
||
| 1595 | public function testExtensionNotLoaded() |
||
| 1599 | |||
| 1600 | public function testValidConstant() |
||
| 1604 | |||
| 1605 | /** |
||
| 1606 | * @expectedException \Assert\InvalidArgumentException |
||
| 1607 | */ |
||
| 1608 | public function testInvalidConstant() |
||
| 1612 | |||
| 1613 | public function testValidVersion() |
||
| 1614 | { |
||
| 1615 | $this->assertTrue(Assertion::version('1.0.0', '<', '2.0.0')); |
||
| 1616 | } |
||
| 1617 | |||
| 1618 | /** |
||
| 1619 | * @expectedException \Assert\InvalidArgumentException |
||
| 1620 | */ |
||
| 1621 | public function testInvalidVersion() |
||
| 1622 | { |
||
| 1623 | Assertion::version('1.0.0', 'eq', '2.0.0'); |
||
| 1624 | } |
||
| 1625 | |||
| 1626 | /** |
||
| 1627 | * @expectedException \Assert\InvalidArgumentException |
||
| 1628 | */ |
||
| 1629 | public function testInvalidVersionOperator() |
||
| 1633 | |||
| 1634 | public function testValidPhpVersion() |
||
| 1638 | |||
| 1639 | /** |
||
| 1640 | * @expectedException \Assert\InvalidArgumentException |
||
| 1641 | */ |
||
| 1642 | public function testInvalidPhpVersion() |
||
| 1646 | |||
| 1647 | public function testValidExtensionVersion() |
||
| 1651 | |||
| 1652 | /** |
||
| 1653 | * @expectedException \Assert\InvalidArgumentException |
||
| 1654 | */ |
||
| 1655 | public function testInvalidExtensionVersion() |
||
| 1659 | } |
||
| 1660 | |||
| 1676 |