File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010 "email" : " support@ip2location.com" ,
1111 "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 =" IP2Proxy 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/IP2Proxy_lib.php ' ;
8+
9+ class FunctionTest extends TestCase
10+ {
11+ public function testGetDb () {
12+ define ('IP2PROXY_DATABASE ' , '.\libraries\ip2proxy\IP2PROXY.BIN ' );
13+ $ ipx = new \App \Libraries \IP2Proxy_lib ();
14+ $ countryCode = $ ipx ->getCountryShort ('1.0.241.135 ' );
15+
16+ $ this ->assertEquals (
17+ 'TH ' ,
18+ $ countryCode ,
19+ );
20+ }
21+
22+ public function testGetWebService () {
23+ $ ipx = new \App \Libraries \IP2Proxy_lib ();
24+ $ record = $ ipx ->getWebService ('1.0.241.135 ' );
25+
26+ $ this ->assertEquals (
27+ 'TH ' ,
28+ $ record ['countryCode ' ],
29+ );
30+ }
31+ }
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 ('IP2Proxy\Test ' , __DIR__ );
You can’t perform that action at this time.
0 commit comments