Skip to content

Commit

Permalink
wrote test for data and updated the readme
Browse files Browse the repository at this point in the history
  • Loading branch information
codejutsu1 committed Mar 30, 2024
1 parent 035f0b0 commit 2a35ea4
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 20 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ VTU_PASSWORD=
```php
<?php
use Codejutsu1\LaravelVtuNg\Facades\Vtu;
try{
$response = Vtu::getBalance();
Expand Down
47 changes: 27 additions & 20 deletions build/report.junit.xml
Original file line number Diff line number Diff line change
@@ -1,31 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite name="/app/phpunit.xml.dist" tests="11" assertions="16" errors="0" failures="0" skipped="0" time="12.869665">
<testsuite name="Codejutsu1/LaravelVtuNg Test Suite" tests="11" assertions="16" errors="0" failures="0" skipped="0" time="12.869665">
<testsuite name="Tests\VtuTest\AirtimeTest" file="tests/VtuTest/AirtimeTest.php" tests="1" assertions="1" errors="0" failures="0" skipped="0" time="2.537379">
<testcase name="it throws an exception when buying airtime" file="tests/VtuTest/AirtimeTest.php::it throws an exception when buying airtime" class="Tests\VtuTest\AirtimeTest" classname="Tests.VtuTest.AirtimeTest" assertions="1" time="2.537379"/>
<testsuite name="/app/phpunit.xml.dist" tests="12" assertions="17" errors="0" failures="1" skipped="0" time="16.868274">
<testsuite name="Codejutsu1/LaravelVtuNg Test Suite" tests="12" assertions="17" errors="0" failures="1" skipped="0" time="16.868274">
<testsuite name="Tests\VtuTest\CableTest" file="tests/VtuTest/CableTest.php" tests="2" assertions="2" errors="0" failures="0" skipped="0" time="8.625978">
<testcase name="it throws an exception when verifying a customer from VTU.ng" file="tests/VtuTest/CableTest.php::it throws an exception when verifying a customer from VTU.ng" class="Tests\VtuTest\CableTest" classname="Tests.VtuTest.CableTest" assertions="1" time="5.839174"/>
<testcase name="it throws an exception when subscribing for a cableTv" file="tests/VtuTest/CableTest.php::it throws an exception when subscribing for a cableTv" class="Tests\VtuTest\CableTest" classname="Tests.VtuTest.CableTest" assertions="1" time="2.786804"/>
</testsuite>
<testsuite name="Tests\VtuTest\ElectricityTest" file="tests/VtuTest/ElectricityTest.php" tests="1" assertions="1" errors="0" failures="0" skipped="0" time="1.856653">
<testcase name="it throws an exception when buying electricity" file="tests/VtuTest/ElectricityTest.php::it throws an exception when buying electricity" class="Tests\VtuTest\ElectricityTest" classname="Tests.VtuTest.ElectricityTest" assertions="1" time="1.856653"/>
<testsuite name="Tests\VtuTest\AirtimeTest" file="tests/VtuTest/AirtimeTest.php" tests="1" assertions="1" errors="0" failures="0" skipped="0" time="1.876512">
<testcase name="it throws an exception when buying airtime" file="tests/VtuTest/AirtimeTest.php::it throws an exception when buying airtime" class="Tests\VtuTest\AirtimeTest" classname="Tests.VtuTest.AirtimeTest" assertions="1" time="1.876512"/>
</testsuite>
<testsuite name="Tests\VtuTest\BalanceTest" file="tests/VtuTest/BalanceTest.php" tests="1" assertions="1" errors="0" failures="0" skipped="0" time="1.937451">
<testcase name="it throws an exception when getting wallet balance" file="tests/VtuTest/BalanceTest.php::it throws an exception when getting wallet balance" class="Tests\VtuTest\BalanceTest" classname="Tests.VtuTest.BalanceTest" assertions="1" time="1.937451"/>
<testsuite name="Tests\ExampleTest" file="tests/ExampleTest.php" tests="1" assertions="1" errors="0" failures="0" skipped="0" time="0.044877">
<testcase name="it can test" file="tests/ExampleTest.php::it can test" class="Tests\ExampleTest" classname="Tests.ExampleTest" assertions="1" time="0.044877"/>
</testsuite>
<testsuite name="Tests\ArchTest" file="tests/ArchTest.php" tests="1" assertions="3" errors="0" failures="0" skipped="0" time="0.292418">
<testcase name="it will not use debugging functions" file="tests/ArchTest.php::it will not use debugging functions" class="Tests\ArchTest" classname="Tests.ArchTest" assertions="3" time="0.292418"/>
<testsuite name="Tests\ArchTest" file="tests/ArchTest.php" tests="1" assertions="3" errors="0" failures="0" skipped="0" time="1.006097">
<testcase name="it will not use debugging functions" file="tests/ArchTest.php::it will not use debugging functions" class="Tests\ArchTest" classname="Tests.ArchTest" assertions="3" time="1.006097"/>
</testsuite>
<testsuite name="Tests\VtuTest\CableTest" file="tests/VtuTest/CableTest.php" tests="2" assertions="2" errors="0" failures="0" skipped="0" time="6.038685">
<testcase name="it throws an exception when subscribing for a cableTv" file="tests/VtuTest/CableTest.php::it throws an exception when subscribing for a cableTv" class="Tests\VtuTest\CableTest" classname="Tests.VtuTest.CableTest" assertions="1" time="2.148215"/>
<testcase name="it throws an exception when verifying a customer from VTU.ng" file="tests/VtuTest/CableTest.php::it throws an exception when verifying a customer from VTU.ng" class="Tests\VtuTest\CableTest" classname="Tests.VtuTest.CableTest" assertions="1" time="3.890470"/>
<testsuite name="Tests\VtuTest\BalanceTest" file="tests/VtuTest/BalanceTest.php" tests="1" assertions="1" errors="0" failures="0" skipped="0" time="2.087023">
<testcase name="it throws an exception when getting wallet balance" file="tests/VtuTest/BalanceTest.php::it throws an exception when getting wallet balance" class="Tests\VtuTest\BalanceTest" classname="Tests.VtuTest.BalanceTest" assertions="1" time="2.087023"/>
</testsuite>
<testsuite name="Tests\VtuTest\PhoneNumberTest" file="tests/VtuTest/PhoneNumberTest.php" tests="4" assertions="7" errors="0" failures="0" skipped="0" time="0.164305">
<testcase name="it doesnt return the wrong network provider of a number" file="tests/VtuTest/PhoneNumberTest.php::it doesnt return the wrong network provider of a number" class="Tests\VtuTest\PhoneNumberTest" classname="Tests.VtuTest.PhoneNumberTest" assertions="2" time="0.050636"/>
<testcase name="it thows an exception for a wrong phone number format" file="tests/VtuTest/PhoneNumberTest.php::it thows an exception for a wrong phone number format" class="Tests\VtuTest\PhoneNumberTest" classname="Tests.VtuTest.PhoneNumberTest" assertions="1" time="0.026340"/>
<testcase name="it can get the network provider of a number" file="tests/VtuTest/PhoneNumberTest.php::it can get the network provider of a number" class="Tests\VtuTest\PhoneNumberTest" classname="Tests.VtuTest.PhoneNumberTest" assertions="2" time="0.050946"/>
<testcase name="it can format a phone number" file="tests/VtuTest/PhoneNumberTest.php::it can format a phone number" class="Tests\VtuTest\PhoneNumberTest" classname="Tests.VtuTest.PhoneNumberTest" assertions="2" time="0.036384"/>
<testsuite name="Tests\VtuTest\PhoneNumberTest" file="tests/VtuTest/PhoneNumberTest.php" tests="4" assertions="7" errors="0" failures="0" skipped="0" time="0.542587">
<testcase name="it thows an exception for a wrong phone number format" file="tests/VtuTest/PhoneNumberTest.php::it thows an exception for a wrong phone number format" class="Tests\VtuTest\PhoneNumberTest" classname="Tests.VtuTest.PhoneNumberTest" assertions="1" time="0.244618"/>
<testcase name="it doesnt return the wrong network provider of a number" file="tests/VtuTest/PhoneNumberTest.php::it doesnt return the wrong network provider of a number" class="Tests\VtuTest\PhoneNumberTest" classname="Tests.VtuTest.PhoneNumberTest" assertions="2" time="0.235043"/>
<testcase name="it can format a phone number" file="tests/VtuTest/PhoneNumberTest.php::it can format a phone number" class="Tests\VtuTest\PhoneNumberTest" classname="Tests.VtuTest.PhoneNumberTest" assertions="2" time="0.034987"/>
<testcase name="it can get the network provider of a number" file="tests/VtuTest/PhoneNumberTest.php::it can get the network provider of a number" class="Tests\VtuTest\PhoneNumberTest" classname="Tests.VtuTest.PhoneNumberTest" assertions="2" time="0.027940"/>
</testsuite>
<testsuite name="Tests\ExampleTest" file="tests/ExampleTest.php" tests="1" assertions="1" errors="0" failures="0" skipped="0" time="0.042773">
<testcase name="it can test" file="tests/ExampleTest.php::it can test" class="Tests\ExampleTest" classname="Tests.ExampleTest" assertions="1" time="0.042773"/>
<testsuite name="Tests\VtuTest\ElectricityTest" file="tests/VtuTest/ElectricityTest.php" tests="1" assertions="1" errors="0" failures="0" skipped="0" time="1.992630">
<testcase name="it throws an exception when buying electricity" file="tests/VtuTest/ElectricityTest.php::it throws an exception when buying electricity" class="Tests\VtuTest\ElectricityTest" classname="Tests.VtuTest.ElectricityTest" assertions="1" time="1.992630"/>
</testsuite>
<testsuite name="Tests\VtuTest\DataTest" file="tests/VtuTest/DataTest.php" tests="1" assertions="1" errors="0" failures="1" skipped="0" time="0.692571">
<testcase name="it returns an exception when you buy data" file="tests/VtuTest/DataTest.php::it returns an exception when you buy data" class="Tests\VtuTest\DataTest" classname="Tests.VtuTest.DataTest" assertions="1" time="0.692571">
<failure type="PHPUnit\Framework\ExpectationFailedException">it returns an exception when you buy dataFailed asserting that exception of type "Error" matches expected exception "Exception". Message was: "Class "Vtu" not found" at
/app/tests/VtuTest/DataTest.php:11
.</failure>
</testcase>
</testsuite>
</testsuite>
</testsuite>
Expand Down
12 changes: 12 additions & 0 deletions tests/VtuTest/DataTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

it("returns an exception when you buy data", function() {
$data = [
'phone' => '07045461790',
'network_id' => 'mtn',
'variation_id' => 'mtn-75gb-15000'
];

vtu()->buyData($data);

})->throws(Exception::class);

0 comments on commit 2a35ea4

Please sign in to comment.