diff --git a/src/ApiV1/Traits/StatusTrait.php b/src/ApiV1/Traits/StatusTrait.php index 4563190..bebf7ef 100644 --- a/src/ApiV1/Traits/StatusTrait.php +++ b/src/ApiV1/Traits/StatusTrait.php @@ -221,10 +221,11 @@ public function getOembed($parameters = []) throw new BadMethodCallException('Parameter required missing : url'); } + // TODO re-implement this $this->tconfig['API_URL'] = 'publish.twitter.com'; $this->tconfig['API_VERSION'] = ''; - return $this->get('oembed', $parameters, false, ''); + return $this->get('oembed', $parameters); } /** diff --git a/src/Service/Querier.php b/src/Service/Querier.php index 0da118e..d43f15c 100644 --- a/src/Service/Querier.php +++ b/src/Service/Querier.php @@ -233,7 +233,7 @@ private function buildUrl(string $endpoint, ?string $host = null, ?string $exten $host ?? $this->config->getApiUrl(), $this->config->getApiVersion(), $endpoint, - $extension === null ? '' : sprintf('.%s', $extension) + empty($extension) ? '' : sprintf('.%s', $extension) ); } } diff --git a/tests/Unit/ApiV1/Service/TwitterTest.php b/tests/Unit/ApiV1/Service/TwitterTest.php index 5fe5867..a5260d0 100644 --- a/tests/Unit/ApiV1/Service/TwitterTest.php +++ b/tests/Unit/ApiV1/Service/TwitterTest.php @@ -299,6 +299,22 @@ public function providerGetListMemberBad(): array ]; } + /** + * @throws BadMethodCallException + * @throws RuntimeException + */ + public function testGetOembed(): void + { + $twitter = $this->getTwitterExpecting( + 'oembed', + [ + 'url' => 'https://twitter.com/jxeeno/status/1343506068236689408', + ] + ); + + $twitter->getOembed(['url' => 'https://twitter.com/jxeeno/status/1343506068236689408']); + } + /** * @return MockObject|Twitter * @throws Exception