Skip to content

Commit

Permalink
fix: oembed method should not have a full stop
Browse files Browse the repository at this point in the history
  • Loading branch information
atymic committed Apr 14, 2021
1 parent 7f43558 commit 8d9b15d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/ApiV1/Traits/StatusTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Service/Querier.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
}
}
16 changes: 16 additions & 0 deletions tests/Unit/ApiV1/Service/TwitterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8d9b15d

Please sign in to comment.