From 8bb49d8ab28919066d2cf4a087d9935abdaf8994 Mon Sep 17 00:00:00 2001 From: Henrique Moody Date: Sun, 17 Feb 2019 21:06:06 +0100 Subject: [PATCH] Unify integration tests PHPT files are amazing, but they are also expensive to execute. Having just one single file running the necessary tests is best than having one file per test. Signed-off-by: Henrique Moody --- tests/integration/rules/identityCard.phpt | 43 ++++++++++++++++++++ tests/integration/rules/identityCard_1.phpt | 15 ------- tests/integration/rules/identityCard_2.phpt | 20 ---------- tests/integration/rules/identityCard_3.phpt | 20 ---------- tests/integration/rules/identityCard_4.phpt | 20 ---------- tests/integration/rules/identityCard_5.phpt | 20 ---------- tests/integration/rules/nif.phpt | 43 ++++++++++++++++++++ tests/integration/rules/nif_1.phpt | 14 ------- tests/integration/rules/nif_2.phpt | 21 ---------- tests/integration/rules/nif_3.phpt | 20 ---------- tests/integration/rules/nif_4.phpt | 21 ---------- tests/integration/rules/nif_5.phpt | 20 ---------- tests/integration/rules/vatin.phpt | 44 +++++++++++++++++++++ tests/integration/rules/vatin_1.phpt | 15 ------- tests/integration/rules/vatin_2.phpt | 21 ---------- tests/integration/rules/vatin_3.phpt | 21 ---------- tests/integration/rules/vatin_4.phpt | 21 ---------- tests/integration/rules/vatin_5.phpt | 20 ---------- 18 files changed, 130 insertions(+), 289 deletions(-) create mode 100644 tests/integration/rules/identityCard.phpt delete mode 100644 tests/integration/rules/identityCard_1.phpt delete mode 100644 tests/integration/rules/identityCard_2.phpt delete mode 100644 tests/integration/rules/identityCard_3.phpt delete mode 100644 tests/integration/rules/identityCard_4.phpt delete mode 100644 tests/integration/rules/identityCard_5.phpt create mode 100644 tests/integration/rules/nif.phpt delete mode 100644 tests/integration/rules/nif_1.phpt delete mode 100644 tests/integration/rules/nif_2.phpt delete mode 100644 tests/integration/rules/nif_3.phpt delete mode 100644 tests/integration/rules/nif_4.phpt delete mode 100644 tests/integration/rules/nif_5.phpt create mode 100644 tests/integration/rules/vatin.phpt delete mode 100644 tests/integration/rules/vatin_1.phpt delete mode 100644 tests/integration/rules/vatin_2.phpt delete mode 100644 tests/integration/rules/vatin_3.phpt delete mode 100644 tests/integration/rules/vatin_4.phpt delete mode 100644 tests/integration/rules/vatin_5.phpt diff --git a/tests/integration/rules/identityCard.phpt b/tests/integration/rules/identityCard.phpt new file mode 100644 index 00000000..a3a92240 --- /dev/null +++ b/tests/integration/rules/identityCard.phpt @@ -0,0 +1,43 @@ +--CREDITS-- +Henrique Moody +--FILE-- +check('AYE205411'); +} catch (PlIdentityCardException $exception) { + echo $exception->getMessage().PHP_EOL; +} + +try { + v::not(v::identityCard('PL'))->check('AYE205410'); +} catch (IdentityCardException $exception) { + echo $exception->getMessage().PHP_EOL; +} + +try { + v::identityCard('PL')->assert('AYE205411'); +} catch (NestedValidationException $exception) { + echo $exception->getFullMessage().PHP_EOL; +} + +try { + v::not(v::identityCard('PL'))->assert('AYE205410'); +} catch (NestedValidationException $exception) { + echo $exception->getFullMessage().PHP_EOL; +} +?> +--EXPECT-- +"AYE205411" must be a valid Polish Identity Card number +"AYE205410" must not be a valid Identity Card number for "PL" +- "AYE205411" must be a valid Polish Identity Card number +- "AYE205410" must not be a valid Identity Card number for "PL" diff --git a/tests/integration/rules/identityCard_1.phpt b/tests/integration/rules/identityCard_1.phpt deleted file mode 100644 index 3d6e6d48..00000000 --- a/tests/integration/rules/identityCard_1.phpt +++ /dev/null @@ -1,15 +0,0 @@ ---CREDITS-- -Henrique Moody ---FILE-- -check('AYE205410'); -v::identityCard('PL')->assert('AYE205410'); -?> ---EXPECT-- diff --git a/tests/integration/rules/identityCard_2.phpt b/tests/integration/rules/identityCard_2.phpt deleted file mode 100644 index 4e59bc2e..00000000 --- a/tests/integration/rules/identityCard_2.phpt +++ /dev/null @@ -1,20 +0,0 @@ ---CREDITS-- -Henrique Moody ---FILE-- -check('AYE205411'); -} catch (PlIdentityCardException $e) { - echo $e->getMessage(); -} -?> ---EXPECT-- -"AYE205411" must be a valid Polish Identity Card number diff --git a/tests/integration/rules/identityCard_3.phpt b/tests/integration/rules/identityCard_3.phpt deleted file mode 100644 index 4c6b5515..00000000 --- a/tests/integration/rules/identityCard_3.phpt +++ /dev/null @@ -1,20 +0,0 @@ ---CREDITS-- -Henrique Moody ---FILE-- -assert('AYE205411'); -} catch (AllOfException $e) { - echo $e->getFullMessage(); -} -?> ---EXPECT-- -- "AYE205411" must be a valid Polish Identity Card number diff --git a/tests/integration/rules/identityCard_4.phpt b/tests/integration/rules/identityCard_4.phpt deleted file mode 100644 index 664702f0..00000000 --- a/tests/integration/rules/identityCard_4.phpt +++ /dev/null @@ -1,20 +0,0 @@ ---CREDITS-- -Henrique Moody ---FILE-- -check('AYE205410'); -} catch (IdentityCardException $e) { - echo $e->getMessage(); -} -?> ---EXPECT-- -"AYE205410" must not be a valid Identity Card number for "PL" diff --git a/tests/integration/rules/identityCard_5.phpt b/tests/integration/rules/identityCard_5.phpt deleted file mode 100644 index 1af0fcb0..00000000 --- a/tests/integration/rules/identityCard_5.phpt +++ /dev/null @@ -1,20 +0,0 @@ ---CREDITS-- -Henrique Moody ---FILE-- -assert('AYE205410'); -} catch (AllOfException $e) { - echo $e->getFullMessage(); -} -?> ---EXPECT-- -- "AYE205410" must not be a valid Identity Card number for "PL" diff --git a/tests/integration/rules/nif.phpt b/tests/integration/rules/nif.phpt new file mode 100644 index 00000000..c378fd13 --- /dev/null +++ b/tests/integration/rules/nif.phpt @@ -0,0 +1,43 @@ +--CREDITS-- +Henrique Moody +Julián Gutiérrez +--FILE-- +check('06357771Q'); +} catch (NifException $exception) { + echo $exception->getMessage().PHP_EOL; +} + +try { + v::not(v::nif())->check('71110316C'); +} catch (NifException $exception) { + echo $exception->getMessage().PHP_EOL; +} + +try { + v::nif()->assert('06357771Q'); +} catch (NestedValidationException $exception) { + echo $exception->getFullMessage().PHP_EOL; +} + +try { + v::not(v::nif())->assert('R1332622H'); +} catch (NestedValidationException $exception) { + echo $exception->getFullMessage().PHP_EOL; +} +?> +--EXPECT-- +"06357771Q" must be a NIF +"71110316C" must not be a NIF +- "06357771Q" must be a NIF +- "R1332622H" must not be a NIF diff --git a/tests/integration/rules/nif_1.phpt b/tests/integration/rules/nif_1.phpt deleted file mode 100644 index 61a149f9..00000000 --- a/tests/integration/rules/nif_1.phpt +++ /dev/null @@ -1,14 +0,0 @@ ---CREDITS-- -Julián Gutiérrez ---FILE-- -check('43333207B'); -?> ---EXPECT-- diff --git a/tests/integration/rules/nif_2.phpt b/tests/integration/rules/nif_2.phpt deleted file mode 100644 index 7146c567..00000000 --- a/tests/integration/rules/nif_2.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---CREDITS-- -Henrique Moody -Julián Gutiérrez ---FILE-- -check('06357771Q'); -} catch (NifException $e) { - echo $e->getMessage(); -} -?> ---EXPECT-- -"06357771Q" must be a NIF diff --git a/tests/integration/rules/nif_3.phpt b/tests/integration/rules/nif_3.phpt deleted file mode 100644 index c8f072af..00000000 --- a/tests/integration/rules/nif_3.phpt +++ /dev/null @@ -1,20 +0,0 @@ ---CREDITS-- -Julián Gutiérrez ---FILE-- -assert('06357771Q'); -} catch (AllOfException $e) { - echo $e->getFullMessage(); -} -?> ---EXPECT-- -- "06357771Q" must be a NIF diff --git a/tests/integration/rules/nif_4.phpt b/tests/integration/rules/nif_4.phpt deleted file mode 100644 index 6b6cafd0..00000000 --- a/tests/integration/rules/nif_4.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---CREDITS-- -Henrique Moody -Julián Gutiérrez ---FILE-- -check('71110316C'); -} catch (NifException $e) { - echo $e->getMessage(); -} -?> ---EXPECT-- -"71110316C" must not be a NIF diff --git a/tests/integration/rules/nif_5.phpt b/tests/integration/rules/nif_5.phpt deleted file mode 100644 index f8dcc099..00000000 --- a/tests/integration/rules/nif_5.phpt +++ /dev/null @@ -1,20 +0,0 @@ ---CREDITS-- -Julián Gutiérrez ---FILE-- -assert('R1332622H'); -} catch (AllOfException $e) { - echo $e->getFullMessage(); -} -?> ---EXPECT-- -- "R1332622H" must not be a NIF diff --git a/tests/integration/rules/vatin.phpt b/tests/integration/rules/vatin.phpt new file mode 100644 index 00000000..4c63681f --- /dev/null +++ b/tests/integration/rules/vatin.phpt @@ -0,0 +1,44 @@ +--CREDITS-- +Henrique Moody +Tomasz Regdos +--FILE-- +check('1645865778'); +} catch (PlVatinException $exception) { + echo $exception->getMessage().PHP_EOL; +} + +try { + v::not(v::vatin('PL'))->check('1645865777'); +} catch (VatinException $exception) { + echo $exception->getMessage().PHP_EOL; +} + +try { + v::vatin('PL')->assert('1645865778'); +} catch (NestedValidationException $exception) { + echo $exception->getFullMessage().PHP_EOL; +} + +try { + v::not(v::vatin('PL'))->assert('1645865777'); +} catch (NestedValidationException $exception) { + echo $exception->getFullMessage().PHP_EOL; +} +?> +--EXPECT-- +"1645865778" must be a valid Polish VAT identification number +"1645865777" must not be a valid VAT identification number for "PL" +- "1645865778" must be a valid Polish VAT identification number +- "1645865777" must not be a valid VAT identification number for "PL" diff --git a/tests/integration/rules/vatin_1.phpt b/tests/integration/rules/vatin_1.phpt deleted file mode 100644 index adf2d14f..00000000 --- a/tests/integration/rules/vatin_1.phpt +++ /dev/null @@ -1,15 +0,0 @@ ---CREDITS-- -Tomasz Regdos ---FILE-- -check('1645865777'); -v::vatin('PL')->assert('1645865777'); -?> ---EXPECT-- diff --git a/tests/integration/rules/vatin_2.phpt b/tests/integration/rules/vatin_2.phpt deleted file mode 100644 index 7292c4a0..00000000 --- a/tests/integration/rules/vatin_2.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---CREDITS-- -Henrique Moody -Tomasz Regdos ---FILE-- -check('1645865778'); -} catch (PlVatinException $e) { - echo $e->getMessage(); -} -?> ---EXPECT-- -"1645865778" must be a valid Polish VAT identification number diff --git a/tests/integration/rules/vatin_3.phpt b/tests/integration/rules/vatin_3.phpt deleted file mode 100644 index c18c0bc5..00000000 --- a/tests/integration/rules/vatin_3.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---CREDITS-- -Henrique Moody -Tomasz Regdos ---FILE-- -assert('1645865778'); -} catch (AllOfException $e) { - echo $e->getFullMessage(); -} -?> ---EXPECT-- -- "1645865778" must be a valid Polish VAT identification number diff --git a/tests/integration/rules/vatin_4.phpt b/tests/integration/rules/vatin_4.phpt deleted file mode 100644 index fdb3ec2d..00000000 --- a/tests/integration/rules/vatin_4.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---CREDITS-- -Henrique Moody -Tomasz Regdos ---FILE-- -check('1645865777'); -} catch (VatinException $e) { - echo $e->getMessage(); -} -?> ---EXPECT-- -"1645865777" must not be a valid VAT identification number for "PL" diff --git a/tests/integration/rules/vatin_5.phpt b/tests/integration/rules/vatin_5.phpt deleted file mode 100644 index 4f9bce0d..00000000 --- a/tests/integration/rules/vatin_5.phpt +++ /dev/null @@ -1,20 +0,0 @@ ---CREDITS-- -Tomasz Regdos ---FILE-- -assert('1645865777'); -} catch (AllOfException $e) { - echo $e->getFullMessage(); -} -?> ---EXPECT-- -- "1645865777" must not be a valid VAT identification number for "PL"