Skip to content

Commit

Permalink
Basic Test
Browse files Browse the repository at this point in the history
  • Loading branch information
yondifon committed Jul 22, 2021
1 parent 09b4abd commit b02a6d7
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 1 deletion.
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,8 @@
"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 b02a6d7

Please sign in to comment.