1 | <?php |
||
5 | class YoutubeProviderTest extends AbstractOembedProviderTestAbstract |
||
6 | { |
||
7 | public function testYoutube() |
||
8 | { |
||
9 | $this->providerFlow( |
||
10 | 'youtube', |
||
11 | 'https://www.youtube.com/watch?v=uN2nqdRLhQ8', |
||
12 | [ |
||
13 | 'providerReference' => 'uN2nqdRLhQ8', |
||
14 | 'title' => 'MediaMonks Mixtape Vol II', |
||
15 | 'description' => '', |
||
16 | 'authorName' => 'MediaMonks', |
||
17 | 'copyright' => '', |
||
18 | 'focalPoint' => '50-50' |
||
19 | ] |
||
20 | ); |
||
21 | |||
22 | $crawler = $this->client->request('GET', '/twig'); |
||
23 | |||
24 | $this->assertEquals( |
||
25 | 2, |
||
26 | $crawler->filter('img')->count() |
||
27 | ); |
||
28 | |||
29 | $this->assertEquals( |
||
30 | 1, |
||
31 | $crawler->filter('iframe')->count() |
||
32 | ); |
||
33 | |||
34 | $this->assertEquals( |
||
35 | 0, |
||
36 | $crawler->filter('a')->count() |
||
37 | ); |
||
38 | } |
||
39 | |||
40 | public function testUnexistingVideo() |
||
41 | { |
||
42 | $provider = 'youtube'; |
||
43 | $providerReference = 'foobar123123123'; |
||
44 | |||
45 | \VCR\VCR::insertCassette('youtube_unexisting'); |
||
46 | $crawler = $this->client->request('GET', self::BASE_PATH.'create?provider='.$provider); |
||
47 | |||
48 | $form = $crawler->selectButton('Create')->form(); |
||
49 | |||
50 | $this->assertSonataFormValues( |
||
51 | $form, |
||
52 | [ |
||
53 | 'provider' => $provider, |
||
54 | ] |
||
55 | ); |
||
56 | |||
57 | $this->updateSonataFormValues( |
||
58 | $form, |
||
59 | [ |
||
60 | 'providerReference' => $providerReference, |
||
61 | ] |
||
62 | ); |
||
63 | |||
64 | $this->client->submit($form); |
||
65 | |||
66 | $this->assertContains('does not exist', $this->client->getResponse()->getContent()); |
||
67 | |||
68 | \VCR\VCR::eject(); |
||
69 | } |
||
70 | } |
||
71 |