diff --git a/composer.json b/composer.json index 5b42605..b6799f6 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,8 @@ ], "require": { "php": ">=7.4", - "swisnl/json-api-client": "1.3.2", + "swisnl/json-api-client": "^2.2.0", + "illuminate/support": "*", "guzzlehttp/guzzle": "^7.0", "phpseclib/phpseclib": "^3.0.7", "ext-openssl": "*", @@ -43,5 +44,10 @@ "test": "XDEBUG_MODE=coverage phpunit", "check-style": "php-cs-fixer fix --dry-run -v", "fix-style": "php-cs-fixer fix" + }, + "config": { + "allow-plugins": { + "php-http/discovery": true + } } } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 0fc0aba..f84beac 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,22 +1,17 @@ - + + + + ./src + + + + + ./tests - - - ./src - - - - - + diff --git a/src/Item/Did.php b/src/Item/Did.php index c766f11..93e2f0e 100644 --- a/src/Item/Did.php +++ b/src/Item/Did.php @@ -34,7 +34,7 @@ public function setDescription(string $desc) $this->attributes['description'] = $desc; } - public function getDescription(): string + public function getDescription(): ?string { return $this->attributes['description']; } diff --git a/tests/DidTest.php b/tests/DidTest.php index 19a2e53..c28742b 100644 --- a/tests/DidTest.php +++ b/tests/DidTest.php @@ -136,6 +136,7 @@ public function testBooleans() $did->setBillingCyclesCount(0); $did->setTerminated(true); + $did->setDescription('something'); $didDocument = $did->save(); $this->assertEquals($did->toJsonApiArray(), [ diff --git a/tests/fixtures/dids.yml b/tests/fixtures/dids.yml index 2eec07e..533c8b8 100644 --- a/tests/fixtures/dids.yml +++ b/tests/fixtures/dids.yml @@ -268,7 +268,7 @@ Access-Control-Allow-Headers: 'Origin, X-Requested-With, Content-Type, Accept, x-api-key, api-key, x-api-token, Cache-Control' Access-Control-Allow-Methods: 'GET, POST, DELETE, PUT, PATCH, OPTIONS' Access-Control-Allow-Credentials: 'true' - body: '{"data":{"id":"9df99644-f1a5-4a3c-99a4-559d758eb96b","type":"dids","attributes":{"blocked":false,"capacity_limit":2,"description":"something","terminated":false,"awaiting_registration":false,"created_at":"2018-12-27T09:59:55.015Z","number":"16091609123456797","expires_at":"2019-11-27T10:00:04.755Z","channels_included_count":0,"billing_cycles_count":null,"dedicated_channels_count":0},"relationships":{"did_group":{"links":{"self":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/relationships/did_group","related":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/did_group"}},"order":{"links":{"self":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/relationships/order","related":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/order"}},"voice_in_trunk":{"links":{"self":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/relationships/voice_in_trunk","related":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/voice_in_trunk"}},"voice_in_trunk_group":{"links":{"self":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/relationships/voice_in_trunk_group","related":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/voice_in_trunk_group"}},"capacity_pool":{"links":{"self":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/relationships/capacity_pool","related":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/capacity_pool"}},"shared_capacity_group":{"links":{"self":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/relationships/shared_capacity_group","related":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/shared_capacity_group"}}}}}' + body: '{"data":{"id":"9df99644-f1a5-4a3c-99a4-559d758eb96b","type":"dids","attributes":{"blocked":false,"capacity_limit":2,"description":null,"terminated":false,"awaiting_registration":false,"created_at":"2018-12-27T09:59:55.015Z","number":"16091609123456797","expires_at":"2019-11-27T10:00:04.755Z","channels_included_count":0,"billing_cycles_count":null,"dedicated_channels_count":0},"relationships":{"did_group":{"links":{"self":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/relationships/did_group","related":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/did_group"}},"order":{"links":{"self":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/relationships/order","related":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/order"}},"voice_in_trunk":{"links":{"self":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/relationships/voice_in_trunk","related":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/voice_in_trunk"}},"voice_in_trunk_group":{"links":{"self":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/relationships/voice_in_trunk_group","related":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/voice_in_trunk_group"}},"capacity_pool":{"links":{"self":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/relationships/capacity_pool","related":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/capacity_pool"}},"shared_capacity_group":{"links":{"self":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/relationships/shared_capacity_group","related":"https://sandbox-api.didww.com/v3/dids/9df99644-f1a5-4a3c-99a4-559d758eb96b/shared_capacity_group"}}}}}' - request: method: PATCH