Skip to content

Commit e174bcd

Browse files
authored
Merge pull request #6 from yondifon/add_pests_tests
add pests tests fixes #3
2 parents 09b4abd + dfdc99d commit e174bcd

File tree

5 files changed

+71
-7
lines changed

5 files changed

+71
-7
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
/vendor
2-
.phpunit.result.cache
2+
.phpunit.result.cache
3+
composer.lock

composer.json

+11-6
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,24 @@
22
"name": "malico/mobile-cm-php",
33
"description": "Get Telephone number's Mobile Network",
44
"license": "MIT",
5+
"archive": {
6+
"exclude": [
7+
"tests"
8+
]
9+
},
510
"authors": [
611
{
712
"name": "Malico",
813
"email": "[email protected]"
914
}
10-
1115
],
12-
"autoload":
13-
{
14-
"psr-4":
15-
{
16+
"autoload": {
17+
"psr-4": {
1618
"Malico\\MobileCM\\": "src/"
1719
}
1820
},
19-
"minimum-stability": "dev"
21+
"minimum-stability": "dev",
22+
"require-dev": {
23+
"pestphp/pest": "1.x-dev"
24+
}
2025
}

phpunit.xml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
4+
bootstrap="vendor/autoload.php"
5+
colors="true"
6+
>
7+
<testsuites>
8+
<testsuite name="Test Suite">
9+
<directory suffix="Test.php">./tests</directory>
10+
</testsuite>
11+
</testsuites>
12+
<coverage processUncoveredFiles="true">
13+
<include>
14+
<directory suffix=".php">./app</directory>
15+
<directory suffix=".php">./src</directory>
16+
</include>
17+
</coverage>
18+
</phpunit>

tests/NetworkTest.php

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
use Malico\MobileCM\Network;
4+
5+
test('test mtn numbers', function () {
6+
$numbers = ['676777777', '237676777777', '676 77 77 77', '+237676777777', '00237676777777'];
7+
8+
expect($numbers)->each(
9+
fn ($number) => expect(Network::isMTN($number->value))
10+
->toBe(true)
11+
);
12+
});
13+
14+
test('test orange numbers', function () {
15+
$numbers = ['699238282', '237699238282', '+237699238282', '00237699238282'];
16+
17+
expect($numbers)->each(
18+
fn ($number) => expect(Network::isOrange($number->value))
19+
->toBe(true)
20+
);
21+
});
22+
23+
test('test nexttel numbers', function () {
24+
$numbers = ['666768293', '237666768293', '+237666768293', '00237666768293'];
25+
26+
expect($numbers)->each(
27+
fn ($number) => expect(Network::isNexttel($number->value))
28+
->toBe(true)
29+
);
30+
});
31+
32+
test('test camtel numbers', function () {
33+
$numbers = ['2 33 47 99 73', '2 22 47 99 73'];
34+
35+
expect($numbers)->each(
36+
fn ($number) => expect(Network::isCamtel($number->value))
37+
->toBe(true)
38+
);
39+
});

tests/Pest.php

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<?php

0 commit comments

Comments
 (0)