From b02a6d7fece114db6d25bb5c371ce7a995e445ab Mon Sep 17 00:00:00 2001 From: Malico Date: Thu, 22 Jul 2021 10:49:41 +0100 Subject: [PATCH] Basic Test --- composer.json | 5 ++++- phpunit.xml | 18 ++++++++++++++++++ tests/NetworkTest.php | 39 +++++++++++++++++++++++++++++++++++++++ tests/Pest.php | 1 + 4 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 phpunit.xml create mode 100644 tests/NetworkTest.php create mode 100644 tests/Pest.php diff --git a/composer.json b/composer.json index 339e574..5d7d352 100644 --- a/composer.json +++ b/composer.json @@ -16,5 +16,8 @@ "Malico\\MobileCM\\": "src/" } }, - "minimum-stability": "dev" + "minimum-stability": "dev", + "require-dev": { + "pestphp/pest": "1.x-dev" + } } diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..8f4b58c --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,18 @@ + + + + + ./tests + + + + + ./app + ./src + + + diff --git a/tests/NetworkTest.php b/tests/NetworkTest.php new file mode 100644 index 0000000..c9bddbd --- /dev/null +++ b/tests/NetworkTest.php @@ -0,0 +1,39 @@ +each( + fn ($number) => expect(Network::isMTN($number->value)) + ->toBe(true) + ); +}); + +test('test orange numbers', function () { + $numbers = ['699238282', '237699238282', '+237699238282', '00237699238282']; + + expect($numbers)->each( + fn ($number) => expect(Network::isOrange($number->value)) + ->toBe(true) + ); +}); + +test('test nexttel numbers', function () { + $numbers = ['666768293', '237666768293', '+237666768293', '00237666768293']; + + expect($numbers)->each( + fn ($number) => expect(Network::isNexttel($number->value)) + ->toBe(true) + ); +}); + +test('test camtel numbers', function () { + $numbers = ['2 33 47 99 73', '2 22 47 99 73']; + + expect($numbers)->each( + fn ($number) => expect(Network::isCamtel($number->value)) + ->toBe(true) + ); +}); diff --git a/tests/Pest.php b/tests/Pest.php new file mode 100644 index 0000000..b3d9bbc --- /dev/null +++ b/tests/Pest.php @@ -0,0 +1 @@ +