Skip to content

Commit

Permalink
Merge pull request #6 from yondifon/add_pests_tests
Browse files Browse the repository at this point in the history
add pests tests fixes #3
  • Loading branch information
yondifon authored Jul 22, 2021
2 parents 09b4abd + dfdc99d commit e174bcd
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/vendor
.phpunit.result.cache
.phpunit.result.cache
composer.lock
17 changes: 11 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,24 @@
"name": "malico/mobile-cm-php",
"description": "Get Telephone number's Mobile Network",
"license": "MIT",
"archive": {
"exclude": [
"tests"
]
},
"authors": [
{
"name": "Malico",
"email": "[email protected]"
}

],
"autoload":
{
"psr-4":
{
"autoload": {
"psr-4": {
"Malico\\MobileCM\\": "src/"
}
},
"minimum-stability": "dev"
"minimum-stability": "dev",
"require-dev": {
"pestphp/pest": "1.x-dev"
}
}
18 changes: 18 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
>
<testsuites>
<testsuite name="Test Suite">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./app</directory>
<directory suffix=".php">./src</directory>
</include>
</coverage>
</phpunit>
39 changes: 39 additions & 0 deletions tests/NetworkTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

use Malico\MobileCM\Network;

test('test mtn numbers', function () {
$numbers = ['676777777', '237676777777', '676 77 77 77', '+237676777777', '00237676777777'];

expect($numbers)->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)
);
});
1 change: 1 addition & 0 deletions tests/Pest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php

0 comments on commit e174bcd

Please sign in to comment.