diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..2bfda12 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,41 @@ +name: Test + +on: + schedule: + - cron: "0 4 * * *" + pull_request: + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref }} + cancel-in-progress: true + +jobs: + test: + name: Test + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [windows-2022, windows-2019, ubuntu-20.04, ubuntu-22.04] + php-version: [8.0, 8.1, 8.2, 8.3] + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + + - name: Install Packages + run: composer install + + - name: Test + run: ./vendor/bin/phpunit tests + + - uses: Bandwidth/build-notify-slack-action@v1.0.0 + if: failure() && !github.event.pull_request.draft + with: + job-status: ${{ job.status }} + slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }} + slack-channel: ${{ secrets.SLACK_CHANNEL }} diff --git a/.gitignore b/.gitignore index 4c78d86..f73aa03 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ config.php composer.lock .idea/ .DS_Store +.phpunit.result.cache diff --git a/README.md b/README.md index 557e6d1..1acc2b3 100644 --- a/README.md +++ b/README.md @@ -30,14 +30,12 @@ PHP Client library for Bandwidth's Phone Number Dashboard (AKA: Dashboard, Iris) ## Supported PHP Versions -| Version | Support Level | -|:-------------------------------|:-------------------------| -| 5.5 | Unsupported | -| 5.6 | Unsupported | -| 7.0 | Unsupported | -| 7.1 | Unsupported | -| 7.2 | Supported | -| 7.3 | Supported | +| Version | Support Level | +|:--------|:-------------------------| +| 8.0 | Supported | +| 8.1 | Supported | +| 8.2 | Supported | +| 8.3 | Supported | ## Install diff --git a/composer.json b/composer.json index dd15ea2..195c083 100644 --- a/composer.json +++ b/composer.json @@ -13,12 +13,12 @@ "guzzlehttp/guzzle": "~7.0" }, "require-dev": { - "phpunit/phpunit": "~4.7" - }, - "config": { - "bin-dir": "bin" + "phpunit/phpunit": "^9" }, "autoload": { + "psr-4": { + "BandwidthLib\\": "src/" + }, "classmap": [ "src/", "core/" diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..5bdcd15 --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,18 @@ + + + + + ./tests + + + diff --git a/src/DisconnectsModel.php b/src/DisconnectsModel.php index 4d37a6f..979b2ba 100644 --- a/src/DisconnectsModel.php +++ b/src/DisconnectsModel.php @@ -33,7 +33,7 @@ public function getList($filters = Array()) } public function disconnect($id, $tndetail = false) { - $d = new Disconnect($this, array("orderId" => $id)); + $d = new Disconnect($this, array("OrderId" => $id)); $d->get($tndetail); return $d; } @@ -68,7 +68,7 @@ class Disconnect extends RestEntry { "CountOfTNs" => [ "type" => "string" ], "userId" => [ "type" => "string" ], "lastModifiedDate" => [ "type" => "string" ], - "orderId" => [ "type" => "string" ], + "OrderId" => [ "type" => "string" ], "OrderType" => [ "type" => "string" ], "OrderDate" => [ "type" => "string" ], "OrderStatus" => [ "type" => "string" ], @@ -114,7 +114,7 @@ public function save() { $data = parent::post(null, "DisconnectTelephoneNumberOrder", $this->to_array()); $this->OrderStatus = new OrderRequestStatus($data); if(isset($this->OrderStatus->orderRequest)) { - $this->orderId = $this->OrderStatus->orderRequest->id; + $this->OrderId = $this->OrderStatus->orderRequest->id; $this->set_data($this->OrderStatus->orderRequest->to_array()); } } @@ -122,12 +122,12 @@ public function save() { /** * Get Entity Id * @return type - * @throws Exception in case of orderId is null + * @throws Exception in case of OrderId is null */ private function get_id() { - if(!isset($this->orderId)) - throw new \Exception("You can't use this function without orderId"); - return $this->orderId; + if(!isset($this->OrderId)) + throw new \Exception("You can't use this function without OrderId"); + return $this->OrderId; } /** diff --git a/tests/AccountTest.php b/tests/AccountTest.php index 17a39b8..dd2a1ce 100644 --- a/tests/AccountTest.php +++ b/tests/AccountTest.php @@ -5,12 +5,14 @@ use GuzzleHttp\Psr7\Response; use GuzzleHttp\Middleware; -class AccountTest extends PHPUnit_Framework_TestCase { +use PHPUnit\Framework\TestCase; + +class AccountTest extends TestCase { public static $container; public static $account; public static $index = 0; - public static function setUpBeforeClass() { + public static function setUpBeforeClass(): void { $mock = new MockHandler([ new Response(200, [], " 2013223685 5209072452 5071Telephone number is not available on the system. 5209072451 13518CNAM for telephone number is applied at the Location level and it is notapplicable at the TN level. "), new Response(200, [], " 1 KNIGHTDALE 426 KNIGHTDALE NC 9192956932 049 Bandwidth CLEC "), @@ -74,6 +76,8 @@ public static function setUpBeforeClass() { $client = new Iris\Client("test", "test", Array('url' => 'https://api.test.inetwork.com/v1.0', 'handler' => $handler)); self::$account = new Iris\Account(9500249, $client); + + return; } public function testLineOption() { @@ -124,6 +128,7 @@ public function testAvailableNumbers2() { * @expectedExceptionCode 4000 */ public function testAvailableNumbersError() { + $this->expectException(Iris\ResponseException::class); $response = self::$account->availableNumbers(); $this->assertEquals("GET", self::$container[self::$index]['request']->getMethod()); diff --git a/tests/BadCredsTest.php b/tests/BadCredsTest.php index 37996f5..036d90a 100644 --- a/tests/BadCredsTest.php +++ b/tests/BadCredsTest.php @@ -4,12 +4,14 @@ use GuzzleHttp\Psr7\Response; use GuzzleHttp\Middleware; -class BadCredsTest extends PHPUnit_Framework_TestCase { +use PHPUnit\Framework\TestCase; + +class BadCredsTest extends TestCase { public static $container; public static $client; public static $index = 0; - public static function setUpBeforeClass() { + public static function setUpBeforeClass(): void { $mock = new MockHandler([ new Response(401, [], ""), ]); @@ -19,7 +21,7 @@ public static function setUpBeforeClass() { $handler = HandlerStack::create($mock); $handler->push($history); - self::$client = new Iris\Client("test", "test", Array('url' => 'https://test.dashboard.bandwidth.com/', 'handler' => $handler)); + self::$client = new Iris\Client("test", "test", Array('url' => 'https://api.test.inetwork.com/v1.0', 'handler' => $handler)); } /** @@ -28,6 +30,7 @@ public static function setUpBeforeClass() { * @expectedExceptionCode 401 */ public function testAuthFail() { + $this->expectException(Iris\ResponseException::class); $c = new \Iris\Cities(self::$client); try { $cities = $c->getList(["state" => "NC"]); diff --git a/tests/BaseModelTest.php b/tests/BaseModelTest.php index 58f03d4..061b3e8 100644 --- a/tests/BaseModelTest.php +++ b/tests/BaseModelTest.php @@ -1 +1 @@ - array("type" => "string"), "Status" => array("type" => "\Iris\Status") ); public function __construct($data) { $this->set_data($data); } } class ArrModel { use \Iris\BaseModel; protected $fields = array( "Item" => array("type" => "ItemModel") ); public function __construct($data) { $this->set_data($data); } } class ItemModel { use \Iris\BaseModel; protected $fields = array( "Phone" => array("type" => "string") ); public function __construct($data) { $this->set_data($data); } } class BaseModelTest extends PHPUnit_Framework_TestCase { public function setUp() { } public function testContent() { $this->model = new Model(array("Id" => "123", "Status" => array("Code" => "0", "Description" => "Empty"))); $this->assertEquals("123", $this->model->Id); $this->assertEquals("0", $this->model->Status->Code); $this->model->set_data(array("Id" => "222", "Status" => array("Code" => "200", "Description" => "Hello"))); $this->assertEquals("222", $this->model->Id); $this->assertEquals("200", $this->model->Status->Code); } public function testArray() { $this->arrModel = new ArrModel(["Item" => [ ["Phone" => "1"], ["Phone" => "2"] ]]); $this->assertEquals("1", $this->arrModel->Item[0]->Phone); $arr = $this->arrModel->to_array(); $this->assertEquals("1", $arr["Item"][0]["Phone"]); } } \ No newline at end of file + array("type" => "string"), "Status" => array("type" => "\Iris\Status") ); public function __construct($data) { $this->set_data($data); } } class ArrModel { use \Iris\BaseModel; protected $fields = array( "Item" => array("type" => "ItemModel") ); public function __construct($data) { $this->set_data($data); } } class ItemModel { use \Iris\BaseModel; protected $fields = array( "Phone" => array("type" => "string") ); public function __construct($data) { $this->set_data($data); } } class BaseModelTest extends TestCase { public function setUp(): void { } public function testContent() { $this->model = new Model(array("Id" => "123", "Status" => array("Code" => "0", "Description" => "Empty"))); $this->assertEquals("123", $this->model->Id); $this->assertEquals("0", $this->model->Status->Code); $this->model->set_data(array("Id" => "222", "Status" => array("Code" => "200", "Description" => "Hello"))); $this->assertEquals("222", $this->model->Id); $this->assertEquals("200", $this->model->Status->Code); } public function testArray() { $this->arrModel = new ArrModel(["Item" => [ ["Phone" => "1"], ["Phone" => "2"] ]]); $this->assertEquals("1", $this->arrModel->Item[0]->Phone); $arr = $this->arrModel->to_array(); $this->assertEquals("1", $arr["Item"][0]["Phone"]); } } \ No newline at end of file diff --git a/tests/CoveredRateCentersTest.php b/tests/CoveredRateCentersTest.php index 0972d43..468bb2f 100644 --- a/tests/CoveredRateCentersTest.php +++ b/tests/CoveredRateCentersTest.php @@ -4,12 +4,14 @@ use GuzzleHttp\Psr7\Response; use GuzzleHttp\Middleware; -class CoveredRateCenterTest extends PHPUnit_Framework_TestCase { +use PHPUnit\Framework\TestCase; + +class CoveredRateCenterTest extends TestCase { public static $container; public static $rcs; public static $index = 0; - public static function setUpBeforeClass() { + public static function setUpBeforeClass(): void { $mock = new MockHandler([ new Response(200, [], " 18 Link=<https://dashboard.bandwidth.com/api/coveredRateCenters?npa=310&size=10&e mbed=Cities&embed=ZipCodes&embed=NpaNxxX&page=1>;rel=\"first\";Link=<https://dashboard.bandwidth.com/api/coveredRateCenters?npa=310&size=10&e mbed=Cities&embed=ZipCodes&embed=NpaNxxX& page=5>;rel=\"next\"; AVALONAVALON CA730 1 90731 SAN PEDRO 0 3105100 3105101 3109498 3109499 42422601 BEVERLY HILLS BEVERLYHLS CA73025 90013 90014 900159150491505 BEVERLY HILLS BURBANK GARDENA LOS ANGELES SHERMAN OAKS SUN VALLEY VAN NUYS 0 3102010310201131020124247777 4247778 42477793 "), new Response(200, [], " AVALONAVALON CA730 1 90731 SAN PEDRO 0 3105100 3105101 3109498 3109499 42422601 "), diff --git a/tests/DisconnectsTest.php b/tests/DisconnectsTest.php index daa4623..88859b3 100644 --- a/tests/DisconnectsTest.php +++ b/tests/DisconnectsTest.php @@ -1 +1 @@ - Disconnect1234 2015-06-17T18:14:08.683Z b902dee1-0585-4258-becd-5c7e51ccf5e1 9192755378 9192755703 normal RECEIVED"), new Response(200, [], "71smckinnon2014-01-10T17-34-15Z6d7da966-e071-4741-b31c-1d8932f4b8dadisconnect2014-01-10T17-34-15.797ZCOMPLETE 1jbm2013-12-04T21-59-32Z4ffe9262-1965-4479-a1d5-b8584440667ddisconnect2013-12-04T21-59-32.243ZCOMPLETE"), new Response(200, [], " 5006 Telephone number could not be disconnected since it is not associated with your account 9192755703 5006 Telephone number could not be disconnected since it is not associated with your account 9192755378 Disconnect1234 2015-06-17T18:14:08.683Z b902dee1-0585-4258-becd-5c7e51ccf5e1 9192755378 9192755703 normal FAILED"), ]); self::$container = []; $history = Middleware::history(self::$container); $handler = HandlerStack::create($mock); $handler->push($history); $client = new Iris\Client("test", "test", Array('url' => 'https://api.test.inetwork.com/v1.0', 'handler' => $handler)); $account = new Iris\Account(9500249, $client); self::$disconnects = $account->disconnects(); } public function testDisconnectCreate() { $disconnect = self::$disconnects->create(array( "name" => "test disconnect order 4", "CustomerOrderId" => "Disconnect1234", "DisconnectTelephoneNumberOrderType" => array( "TelephoneNumberList" => array( "TelephoneNumber" => array("9192755378", "9192755703") ) ) )); $json = '{"OrderId":"b902dee1-0585-4258-becd-5c7e51ccf5e1","OrderStatus":{"orderRequest":{"CustomerOrderId":"Disconnect1234","OrderCreateDate":"2015-06-17T18:14:08.683Z","id":"b902dee1-0585-4258-becd-5c7e51ccf5e1","DisconnectTelephoneNumberOrderType":{"TelephoneNumberList":{"TelephoneNumber":["9192755378","9192755703"]},"DisconnectMode":"normal"}},"OrderStatus":"RECEIVED"},"name":"test disconnect order 4","CustomerOrderId":"Disconnect1234","DisconnectTelephoneNumberOrderType":{"TelephoneNumberList":{"TelephoneNumber":["9192755378","9192755703"]},"DisconnectMode":"normal"},"OrderCreateDate":"2015-06-17T18:14:08.683Z"}'; $this->assertEquals($json, json_encode($disconnect->to_array())); $this->assertEquals("RECEIVED", $disconnect->OrderStatus->OrderStatus); $this->assertEquals("b902dee1-0585-4258-becd-5c7e51ccf5e1", $disconnect->OrderId); $this->assertEquals("POST", self::$container[self::$index]['request']->getMethod()); $this->assertEquals("https://api.test.inetwork.com/v1.0/accounts/9500249/disconnects", self::$container[self::$index]['request']->getUri()); self::$index++; } public function testDisconnectsGet() { $disconnects = self::$disconnects->getList(); $json = '{"CountOfTNs":"1","userId":"smckinnon","lastModifiedDate":"2014-01-10T17-34-15Z","OrderId":"6d7da966-e071-4741-b31c-1d8932f4b8da","OrderType":"disconnect","OrderDate":"2014-01-10T17-34-15.797Z","OrderStatus":"COMPLETE"}'; $this->assertEquals(2, count($disconnects)); $this->assertEquals($json, json_encode($disconnects[0]->to_array())); $this->assertEquals("GET", self::$container[self::$index]['request']->getMethod()); $this->assertEquals("https://api.test.inetwork.com/v1.0/accounts/9500249/disconnects?page=1&size=30", self::$container[self::$index]['request']->getUri()); self::$index++; } public function testDisconnectGet() { $disconnect = self::$disconnects->create(["OrderId" => "b902dee1-0585-4258-becd-5c7e51ccf5e1"], false); $response = $disconnect->get(true); $json = '{"OrderId":"b902dee1-0585-4258-becd-5c7e51ccf5e1","CustomerOrderId":"Disconnect1234","DisconnectTelephoneNumberOrderType":{"TelephoneNumberList":{"TelephoneNumber":["9192755378","9192755703"]},"DisconnectMode":"normal"},"OrderCreateDate":"2015-06-17T18:14:08.683Z"}'; $this->assertEquals($json, json_encode($disconnect->to_array())); $json1 = '{"ErrorList":{"Error":[{"TelephoneNumber":"9192755703","Code":"5006","Description":"Telephone number could not be disconnected since it is not associated with your account"},{"TelephoneNumber":"9192755378","Code":"5006","Description":"Telephone number could not be disconnected since it is not associated with your account"}]},"OrderStatus":"FAILED"}'; $this->assertEquals($json1, json_encode($response->to_array())); $this->assertEquals("GET", self::$container[self::$index]['request']->getMethod()); $this->assertEquals("https://api.test.inetwork.com/v1.0/accounts/9500249/disconnects/b902dee1-0585-4258-becd-5c7e51ccf5e1?tndetail=true", self::$container[self::$index]['request']->getUri()); self::$index++; } } \ No newline at end of file + Disconnect1234 2015-06-17T18:14:08.683Z b902dee1-0585-4258-becd-5c7e51ccf5e1 9192755378 9192755703 normal RECEIVED"), new Response(200, [], "71smckinnon2014-01-10T17-34-15Z6d7da966-e071-4741-b31c-1d8932f4b8dadisconnect2014-01-10T17-34-15.797ZCOMPLETE 1jbm2013-12-04T21-59-32Z4ffe9262-1965-4479-a1d5-b8584440667ddisconnect2013-12-04T21-59-32.243ZCOMPLETE"), new Response(200, [], " 5006 Telephone number could not be disconnected since it is not associated with your account 9192755703 5006 Telephone number could not be disconnected since it is not associated with your account 9192755378 Disconnect1234 2015-06-17T18:14:08.683Z b902dee1-0585-4258-becd-5c7e51ccf5e1 9192755378 9192755703 normal FAILED"), ]); self::$container = []; $history = Middleware::history(self::$container); $handler = HandlerStack::create($mock); $handler->push($history); $client = new Iris\Client("test", "test", Array('url' => 'https://api.test.inetwork.com/v1.0', 'handler' => $handler)); $account = new Iris\Account(9500249, $client); self::$disconnects = $account->disconnects(); } public function testDisconnectCreate() { $disconnect = self::$disconnects->create(array( "name" => "test disconnect order 4", "CustomerOrderId" => "Disconnect1234", "DisconnectTelephoneNumberOrderType" => array( "TelephoneNumberList" => array( "TelephoneNumber" => array("9192755378", "9192755703") ) ) )); $json = '{"OrderId":"b902dee1-0585-4258-becd-5c7e51ccf5e1","OrderStatus":{"orderRequest":{"CustomerOrderId":"Disconnect1234","OrderCreateDate":"2015-06-17T18:14:08.683Z","id":"b902dee1-0585-4258-becd-5c7e51ccf5e1","DisconnectTelephoneNumberOrderType":{"TelephoneNumberList":{"TelephoneNumber":["9192755378","9192755703"]},"DisconnectMode":"normal"}},"OrderStatus":"RECEIVED"},"name":"test disconnect order 4","CustomerOrderId":"Disconnect1234","DisconnectTelephoneNumberOrderType":{"TelephoneNumberList":{"TelephoneNumber":["9192755378","9192755703"]},"DisconnectMode":"normal"},"OrderCreateDate":"2015-06-17T18:14:08.683Z"}'; $this->assertEquals($json, json_encode($disconnect->to_array())); $this->assertEquals("RECEIVED", $disconnect->OrderStatus->OrderStatus); $this->assertEquals("b902dee1-0585-4258-becd-5c7e51ccf5e1", $disconnect->OrderId); $this->assertEquals("POST", self::$container[self::$index]['request']->getMethod()); $this->assertEquals("https://api.test.inetwork.com/v1.0/accounts/9500249/disconnects", self::$container[self::$index]['request']->getUri()); self::$index++; } public function testDisconnectsGet() { $disconnects = self::$disconnects->getList(); $json = '{"CountOfTNs":"1","userId":"smckinnon","lastModifiedDate":"2014-01-10T17-34-15Z","OrderId":"6d7da966-e071-4741-b31c-1d8932f4b8da","OrderType":"disconnect","OrderDate":"2014-01-10T17-34-15.797Z","OrderStatus":"COMPLETE"}'; $this->assertEquals(2, count($disconnects)); $this->assertEquals($json, json_encode($disconnects[0]->to_array())); $this->assertEquals("GET", self::$container[self::$index]['request']->getMethod()); $this->assertEquals("https://api.test.inetwork.com/v1.0/accounts/9500249/disconnects?page=1&size=30", self::$container[self::$index]['request']->getUri()); self::$index++; } public function testDisconnectGet() { $disconnect = self::$disconnects->create(["OrderId" => "b902dee1-0585-4258-becd-5c7e51ccf5e1"], false); $response = $disconnect->get(true); $json = '{"OrderId":"b902dee1-0585-4258-becd-5c7e51ccf5e1","CustomerOrderId":"Disconnect1234","DisconnectTelephoneNumberOrderType":{"TelephoneNumberList":{"TelephoneNumber":["9192755378","9192755703"]},"DisconnectMode":"normal"},"OrderCreateDate":"2015-06-17T18:14:08.683Z"}'; $this->assertEquals($json, json_encode($disconnect->to_array())); $json1 = '{"ErrorList":{"Error":[{"TelephoneNumber":"9192755703","Code":"5006","Description":"Telephone number could not be disconnected since it is not associated with your account"},{"TelephoneNumber":"9192755378","Code":"5006","Description":"Telephone number could not be disconnected since it is not associated with your account"}]},"OrderStatus":"FAILED"}'; $this->assertEquals($json1, json_encode($response->to_array())); $this->assertEquals("GET", self::$container[self::$index]['request']->getMethod()); $this->assertEquals("https://api.test.inetwork.com/v1.0/accounts/9500249/disconnects/b902dee1-0585-4258-becd-5c7e51ccf5e1?tndetail=true", self::$container[self::$index]['request']->getUri()); self::$index++; } } \ No newline at end of file diff --git a/tests/DldaTest.php b/tests/DldaTest.php index 04e4bd3..21fa3b8 100644 --- a/tests/DldaTest.php +++ b/tests/DldaTest.php @@ -4,12 +4,14 @@ use GuzzleHttp\Psr7\Response; use GuzzleHttp\Middleware; -class DldasTest extends PHPUnit_Framework_TestCase { +use PHPUnit\Framework\TestCase; + +class DldasTest extends TestCase { public static $container; public static $dldas; public static $index = 0; - public static function setUpBeforeClass() { + public static function setUpBeforeClass(): void { $mock = new MockHandler([ new Response(200, [], "5a88d16d-f8a9-45c5-a5db-137d700c6a222014-07-10T12:38:11.833Z14jbmea9e90c2-77a4-4f82-ac47-e1c5bb1311f42014-07-10T12:38:11.833ZRECEIVED20537783352053865784BUSINESSLISTEDJoeSmithtrue
12ELMNew YorkNY10007United StatesDlda
"), new Response(200, [], "3142team_ua2014-07-07T10:06:43.427Zdlda2014-07-07T10:06:43.427Z37a6447c-1a0b-4be9-ba89-3f5cb0aea142FAILED142team_ua2014-07-07T10:05:56.595Zdlda2014-07-07T10:05:56.595Z743b0e64-3350-42e4-baa6-406dac7f4a85RECEIVED142team_ua2014-07-07T09:32:17.234Zdlda2014-07-07T09:32:17.234Zf71eb4d2-bfef-4384-957f-45cd6321185eRECEIVED"), diff --git a/tests/LidbsTest.php b/tests/LidbsTest.php index 8739b2a..90f52c6 100644 --- a/tests/LidbsTest.php +++ b/tests/LidbsTest.php @@ -4,12 +4,14 @@ use GuzzleHttp\Psr7\Response; use GuzzleHttp\Middleware; -class LidbsTest extends PHPUnit_Framework_TestCase { +use PHPUnit\Framework\TestCase; + +class LidbsTest extends TestCase { public static $container; public static $lidbs; public static $index = 0; - public static function setUpBeforeClass() { + public static function setUpBeforeClass(): void { $mock = new MockHandler([ new Response(200, [], "2122999999902014-02-25T16:02:43.195Zlidb2014-02-25T16:02:43.195Zabe36738-6929-4c6f-926c-88e534e2d46fFAILEDteam_ua999999902014-02-25T16:02:39.021Zlidb2014-02-25T16:02:39.021Zba5b6297-139b-4430-aab0-9ff02c4362f4FAILEDteam_ua"), new Response(200, [], "testCustomerOrderId255bda29-fc57-44e8-a6c2-59b45388c6d0 2014-05-28T14:46:21.724ZRECEIVEDjbm2014-02-20T19:33:17.600Z2014-02-20T19:33:17.600Z40822133118042105618FredBUSINESSPRIVATE408221285040822133108042105760FredRESIDENTIALPUBLIC"), diff --git a/tests/NotesReferencesTest.php b/tests/NotesReferencesTest.php index 0305e37..4caf345 100644 --- a/tests/NotesReferencesTest.php +++ b/tests/NotesReferencesTest.php @@ -5,12 +5,14 @@ use GuzzleHttp\Psr7\Response; use GuzzleHttp\Middleware; -class NotesRefTest extends PHPUnit_Framework_TestCase { +use PHPUnit\Framework\TestCase; + +class NotesRefTest extends TestCase { public static $container; public static $account; public static $index = 0; - public static function setUpBeforeClass() { + public static function setUpBeforeClass(): void { $mock = new MockHandler([ new Response(200, [], " 11425 byo_dev Test Note 2015-06-18T04:19:59.000Z "), new Response(200, [], " 11425 byo_dev Test Note 2015-06-18T04:19:59.000Z "), diff --git a/tests/NotesTest.php b/tests/NotesTest.php index 0c3cfeb..bcf939e 100644 --- a/tests/NotesTest.php +++ b/tests/NotesTest.php @@ -5,12 +5,14 @@ use GuzzleHttp\Psr7\Response; use GuzzleHttp\Middleware; -class NotesTest extends PHPUnit_Framework_TestCase { +use PHPUnit\Framework\TestCase; + +class NotesTest extends TestCase { public static $container; public static $notes; public static $index = 0; - public static function setUpBeforeClass() { + public static function setUpBeforeClass(): void { $mock = new MockHandler([ new Response(200, ['Location' => 'https://api.test.inetwork.com/v1.0/accounts/9500249/disconnects/b902dee1-0585-4258-becd-5c7e51ccf5e1/notes/123']), new Response(200, [], " 11425 byo_dev Test Note 2015-06-18T04:19:59.000Z "), diff --git a/tests/OrderTest.php b/tests/OrderTest.php index b1c67fb..84d8450 100644 --- a/tests/OrderTest.php +++ b/tests/OrderTest.php @@ -5,12 +5,14 @@ use GuzzleHttp\Psr7\Response; use GuzzleHttp\Middleware; -class OrderTest extends PHPUnit_Framework_TestCase { +use PHPUnit\Framework\TestCase; + +class OrderTest extends TestCase { public static $container; public static $account; public static $index = 0; - public static function setUpBeforeClass() { + public static function setUpBeforeClass(): void { $mock = new MockHandler([ new Response(200, [], " 2 Link=<https://api.test.inetwork.com:443/v1.0/accounts/9500249/orders?page=1&size=300>;rel=\"first\"; 0 123456789 byo_dev 2015-06-13T16:14:46.017Z 2015-06-13T16:14:45.956Z new_number 016c1aef-a873-4a90-8374-60771cba9452 FAILED 0 123456789 byo_dev 2015-06-13T16:32:04.216Z 2015-06-13T16:32:04.181Z new_number 77659f47-d527-42ad-bf72-34b6841016ac FAILED "), new Response(200, [], " 1 Link=<https://api.test.inetwork.com:443/v1.0/accounts/9500249/orders?page=1&size=300>;rel=\"first\"; 0 123456789 byo_dev 2015-06-13T16:14:46.017Z 2015-06-13T16:14:45.956Z new_number 016c1aef-a873-4a90-8374-60771cba9452 FAILED "), diff --git a/tests/OtherTest.php b/tests/OtherTest.php index 59aac59..f5b336f 100644 --- a/tests/OtherTest.php +++ b/tests/OtherTest.php @@ -4,12 +4,14 @@ use GuzzleHttp\Psr7\Response; use GuzzleHttp\Middleware; -class OtherTest extends PHPUnit_Framework_TestCase { +use PHPUnit\Framework\TestCase; + +class OtherTest extends TestCase { public static $container; public static $client; public static $index = 0; - public static function setUpBeforeClass() { + public static function setUpBeforeClass(): void { $mock = new MockHandler([ new Response(200, [], " 618 PINEHURST ABERDEEN JULIAN ADVANCE "), new Response(200, [], " 652 AGOURA AGOURA ALAMITOS ALAMITOS "), diff --git a/tests/PortinsTest.php b/tests/PortinsTest.php index 3028da7..49963c5 100644 --- a/tests/PortinsTest.php +++ b/tests/PortinsTest.php @@ -5,12 +5,14 @@ use GuzzleHttp\Psr7\Response; use GuzzleHttp\Middleware; -class PortinsTest extends PHPUnit_Framework_TestCase { +use PHPUnit\Framework\TestCase; + +class PortinsTest extends TestCase { public static $container; public static $portins; public static $index = 0; - public static function setUpBeforeClass() { + public static function setUpBeforeClass(): void { $mock = new MockHandler([ new Response(200, [], "d28b36f7-fa96-49eb-9556-a40fca49f7c6201Order request received. Please use the order id to check the status of your order later.PENDING_DOCUMENTSJohn DoeBUSINESSAcme Corporation1623Brockton Ave #1Los AngelesCA90025USA6882015002917513124568820150256882015026falsePORTIN"), new Response(200), @@ -203,7 +205,7 @@ public function testPortinsSetActivationStatus() { ]); $this->assertEquals("6052609021", $status->ActivatedTelephoneNumbersList->TelephoneNumber[0]); - $this->assertEquals("POST", self::$container[self::$index]['request']->getMethod()); + $this->assertEquals("PUT", self::$container[self::$index]['request']->getMethod()); $this->assertEquals("https://api.test.inetwork.com/v1.0/accounts/9500249/portins/d28b36f7-fa96-49eb-9556-a40fca49f7c6/activationStatus", self::$container[self::$index]['request']->getUri()); self::$index++; } @@ -279,7 +281,7 @@ public function testTotals() { public function testLoasSend() { $portin = self::$portins->portin(""); - $response = $portin->loas_send('./tests/test.txt', array("Content-Type" => "text/plain")); + $response = $portin->loas_send('./tests/fixtures/loa_test.txt', array("Content-Type" => "text/plain")); $this->assertEquals("filename", $response); } diff --git a/tests/PortoutsTest.php b/tests/PortoutsTest.php index c28bec8..5051085 100644 --- a/tests/PortoutsTest.php +++ b/tests/PortoutsTest.php @@ -5,12 +5,14 @@ // use GuzzleHttp\Psr7\Response; // use GuzzleHttp\Middleware; // -// class PortoutsTest extends PHPUnit_Framework_TestCase { +// use PHPUnit\Framework\TestCase; +// +// class PortoutsTest extends TestCase { // public static $container; // public static $portouts; // public static $index = 0; // -// public static function setUpBeforeClass() { +// public static function setUpBeforeClass(): void { // $mock = new MockHandler([ // ]); // diff --git a/tests/ReportsTest.php b/tests/ReportsTest.php index 7892746..1214b98 100644 --- a/tests/ReportsTest.php +++ b/tests/ReportsTest.php @@ -5,12 +5,14 @@ use GuzzleHttp\Psr7\Response; use GuzzleHttp\Middleware; -class ReportsTest extends PHPUnit_Framework_TestCase { +use PHPUnit\Framework\TestCase; + +class ReportsTest extends TestCase { public static $container; public static $reports; public static $index = 0; - public static function setUpBeforeClass() { + public static function setUpBeforeClass(): void { $mock = new MockHandler([ //GET report new Response(200, [], 'Sample Report 1100020Sample Report 1 DescriptionSample Report 2100021Sample Report 2 Description'), diff --git a/tests/SippeersTest.php b/tests/SippeersTest.php index 670925b..916ffb2 100644 --- a/tests/SippeersTest.php +++ b/tests/SippeersTest.php @@ -4,12 +4,14 @@ use GuzzleHttp\Psr7\Response; use GuzzleHttp\Middleware; -class SippeersTest extends PHPUnit_Framework_TestCase { +use PHPUnit\Framework\TestCase; + +class SippeersTest extends TestCase { public static $container; public static $sippeers; public static $index = 0; - public static function setUpBeforeClass() { + public static function setUpBeforeClass(): void { $mock = new MockHandler([ new Response(201, ['Location' => 'https://api.test.inetwork.com:443/v1.0/accounts/9500249/sites/2489/sippeers/9091']), new Response(200, [], " 500709 Test4 Peer true SMPP 192.168.181.94 192.168.181.94 192.168.181.94 0 DOMESTIC true 500705 Test2 Peer false SMPP 192.168.181.98 192.168.181.98 192.168.181.98 0 DOMESTIC true "), diff --git a/tests/SiteTest.php b/tests/SiteTest.php index bef4233..8cf31ec 100644 --- a/tests/SiteTest.php +++ b/tests/SiteTest.php @@ -4,12 +4,14 @@ use GuzzleHttp\Psr7\Response; use GuzzleHttp\Middleware; -class SiteTest extends PHPUnit_Framework_TestCase { +use PHPUnit\Framework\TestCase; + +class SiteTest extends TestCase { public static $container; public static $sites; public static $index = 0; - public static function setUpBeforeClass() { + public static function setUpBeforeClass(): void { $mock = new MockHandler([ new Response(201, ['Location' => 'https://api.test.inetwork.com:443/v1.0/accounts/9500249/sites/2489']), new Response(200, [], " 2297 API Test Site 2301 My First Site A Site From Node SDK Examples "), diff --git a/tests/SubscriptionsNew.php b/tests/SubscriptionsNew.php index 6a3df0e..28fc34a 100644 --- a/tests/SubscriptionsNew.php +++ b/tests/SubscriptionsNew.php @@ -1,6 +1,8 @@ 'https://api.test.inetwork.com:443/v1.0/accounts/9500249/sunscriptions/2489']), new Response(200, [], "1orders8684b1c8-7d41-4877-bfc2-6bd8ea4dc89ftest@testNONE"), diff --git a/tests/TnsTest.php b/tests/TnsTest.php index 4bd53b5..f009dea 100644 --- a/tests/TnsTest.php +++ b/tests/TnsTest.php @@ -4,12 +4,14 @@ use GuzzleHttp\Psr7\Response; use GuzzleHttp\Middleware; -class TnsTest extends PHPUnit_Framework_TestCase { +use PHPUnit\Framework\TestCase; + +class TnsTest extends TestCase { public static $container; public static $tns; public static $index = 0; - public static function setUpBeforeClass() { + public static function setUpBeforeClass(): void { $mock = new MockHandler([ new Response(200, [], " 2 Link=<https://api.test.inetwork.com:443/v1.0/tns?size=500&page=1>;rel=\"first\"; CHESAPEAKE 252 VA 7576768750 0 49 Bandwidth CLEC NRFOLKZON1 PortInPendingFoc 9500249 2015-06-03T15:10:13.000Z AGOURA 730 CA 8183386247 0 49 Bandwidth CLEC AGOURA Inservice 9500249 2015-05-30T14:40:54.000Z "), new Response(200, [], " 7576768750 PortInPendingFoc 2015-06-03T15:10:13.000Z 2015-06-03T15:10:12.808Z 98939562-90b0-40e9-8335-5526432d9741 PORT_NUMBER_ORDER 2297 9500249"), diff --git a/tests/UsersTest.php b/tests/UsersTest.php index 3ed82ba..5eb7153 100644 --- a/tests/UsersTest.php +++ b/tests/UsersTest.php @@ -4,13 +4,15 @@ use GuzzleHttp\Psr7\Response; use GuzzleHttp\Middleware; -class UsersTest extends PHPUnit_Framework_TestCase { +use PHPUnit\Framework\TestCase; + +class UsersTest extends TestCase { public static $container; public static $client; public static $account; public static $index = 0; - public static function setUpBeforeClass() { + public static function setUpBeforeClass(): void { $mock = new MockHandler([ new Response(200, [], "byo_devtesttestjsommerset@bandwidth.com5413637598ROLE_USERUPDATEVIEWROLE_BDRUPDATEVIEWROLE_API_HISTORYUPDATEVIEWROLE_API_SITEUPDATEVIEWROLE_API_SEARCHVIEWROLE_API_ORDERINGUPDATEVIEWROLE_API_PROFILEUPDATEVIEWROLE_API_LNPUPDATEVIEWROLE_API_ACCOUNTVIEWROLE_API_DLDAUPDATEVIEWROLE_API_CNAMLIDBUPDATEVIEW"), new Response(200, [], ""), diff --git a/tests/fixtures/loa_test.txt b/tests/fixtures/loa_test.txt new file mode 100644 index 0000000..738854b --- /dev/null +++ b/tests/fixtures/loa_test.txt @@ -0,0 +1 @@ +This is a test fixture