-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #107 from creative-commoners/pulls/2.10/guzzle
FIX Update oembed config
- Loading branch information
Showing
3 changed files
with
31 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace CWP\Core\Tests; | ||
|
||
use Embed\Http\Crawler; | ||
use GuzzleHttp\Client; | ||
use SilverStripe\Core\Injector\Injector; | ||
use SilverStripe\Dev\SapphireTest; | ||
|
||
class OEmbedTest extends SapphireTest | ||
{ | ||
/** | ||
* Ensure that the Psr\Http\Client\ClientInterface.oembed created is a | ||
* GuzzleHttp\Client which can have the CWP outband proxy configuration applied to it | ||
* | ||
* This is to ensure the config in cwp-core/_config/oembed.yml aligns with the | ||
* configured ClientInterface in the required version of framework | ||
*/ | ||
public function testGuzzleProxyConfig() | ||
{ | ||
$reflClass = new \ReflectionClass(Crawler::class); | ||
$reflProperty = $reflClass->getProperty('client'); | ||
$reflProperty->setAccessible(true); | ||
$crawler = Injector::inst()->get(Crawler::class); | ||
$client = $reflProperty->getValue($crawler); | ||
$this->assertSame(Client::class, get_class($client)); | ||
} | ||
} |