A nice video
EOS , $result ); } public function testSoundcloud() { /** @var string $result */ $result = $this->mockRequest( ['url' => static::$test_soundcloud], [ 'version' => 1, 'type' => 'rich', 'provider_name' => 'SoundCloud', 'provider_url' => 'http://soundcloud.com', 'height' => 400, 'width' => '100%', 'title' => 'DELAIN - Suckerpunch by Napalm Records', 'description' => 'Taken from the EP "Lunar Prelude": http://shop.napalmrecords.com/delain', 'thumbnail_url' => 'http://i1.sndcdn.com/artworks-000143578557-af0v6l-t500x500.jpg', 'html' => '', 'author_name' => 'Napalm Records', 'author_url' => 'http://soundcloud.com/napalmrecords', ] ); $this->assertEqualIgnoringWhitespace( <<Some content with an [embed url="' . $url . '" thumbnail="https://example.com/mythumb.jpg" ' . 'class="leftAlone ss-htmleditorfield-file embed" width="480" height="270"]' . $url . '[/embed]
'; $embedHtml = ''; $parser = ShortcodeParser::get('default'); // use reflection to access private methods $provider = new EmbedShortcodeProvider(); $reflector = new \ReflectionClass(EmbedShortcodeProvider::class); $method = $reflector->getMethod('getCache'); $method->setAccessible(true); $cache = $method->invokeArgs($provider, []); $method = $reflector->getMethod('deriveCacheKey'); $method->setAccessible(true); $class = 'leftAlone ss-htmleditorfield-file embed'; $width = '480'; $height = '270'; $key = $method->invokeArgs($provider, [$url, $class, $width, $height]); // assertions $this->assertEquals('embed-shortcode-httpwwwtest-servicecomabc123-leftAloness-htmleditorfield-fileembed-480-270', $key); $cache->set($key, $embedHtml); $this->assertTrue($cache->has($key)); EmbedShortcodeProvider::flushCachedShortcodes($parser, $content); $this->assertFalse($cache->has($key)); } }