File tree Expand file tree Collapse file tree 4 files changed +50
-1
lines changed
Expand file tree Collapse file tree 4 files changed +50
-1
lines changed Original file line number Diff line number Diff line change 10101111 "homepage" : " https://www.ip2location.com"
1212 }
13- ]
13+ ],
14+ "require-dev" : {
15+ "phpunit/phpunit" : " ^9"
16+ }
1417}
Original file line number Diff line number Diff line change 1+ <phpunit bootstrap =" tests/bootstrap.php" colors =" true" >
2+ <testsuites >
3+ <testsuite name =" IP2Location CodeIgniter Testcase" >
4+ <directory suffix =" Test.php" >./tests/</directory >
5+ </testsuite >
6+ </testsuites >
7+ </phpunit >
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ use PHPUnit \Framework \TestCase ;
6+
7+ require_once './libraries/IP2Location_lib.php ' ;
8+
9+ class FunctionTest extends TestCase
10+ {
11+ public function testGetDb () {
12+ $ ipl = new \App \Libraries \IP2Location_lib ();
13+ $ countryCode = $ ipl ->getCountryCode ('8.8.8.8 ' );
14+
15+ $ this ->assertEquals (
16+ 'US ' ,
17+ $ countryCode ,
18+ );
19+ }
20+
21+ public function testGetWebService () {
22+ $ ipl = new \App \Libraries \IP2Location_lib ();
23+ $ record = $ ipl ->getWebService ('8.8.8.8 ' );
24+
25+ $ this ->assertEquals (
26+ 'US ' ,
27+ $ record ['country_code ' ],
28+ );
29+ }
30+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ if (!$ loader = @include './vendor/autoload.php ' ) {
6+ die ('Project dependencies missing ' );
7+ }
8+
9+ $ loader ->add ('IP2Location\Test ' , __DIR__ );
You can’t perform that action at this time.
0 commit comments