Autoload.php
9 years ago
TestEmbera.php
9 years ago
TestFakeResponse.php
9 years ago
TestFormatter.php
9 years ago
TestHttpRequest.php
9 years ago
TestOembed.php
9 years ago
TestProviders.php
9 years ago
TestServiceAmCharts.php
9 years ago
TestServiceAnimatron.php
9 years ago
TestServiceAnimoto.php
9 years ago
TestServiceAolOn.php
9 years ago
TestServiceAppNet.php
9 years ago
TestServiceAudioSnaps.php
9 years ago
TestServiceBambuser.php
9 years ago
TestServiceBlipTv.php
9 years ago
TestServiceCacoo.php
9 years ago
TestServiceChartblocks.php
9 years ago
TestServiceChirbit.php
9 years ago
TestServiceCircuitLab.php
9 years ago
TestServiceClyp.php
9 years ago
TestServiceCodepoints.php
9 years ago
TestServiceCollegeHumor.php
9 years ago
TestServiceCoub.php
9 years ago
TestServiceCrowdRanking.php
9 years ago
TestServiceDailyMile.php
9 years ago
TestServiceDailyMotion.php
9 years ago
TestServiceDeviantart.php
9 years ago
TestServiceDipity.php
9 years ago
TestServiceDotSub.php
9 years ago
TestServiceEdocr.php
9 years ago
TestServiceEgliseInfo.php
9 years ago
TestServiceFacebook.php
9 years ago
TestServiceFlickr.php
9 years ago
TestServiceFunnyOrDie.php
9 years ago
TestServiceGeographCI.php
9 years ago
TestServiceGeographDe.php
9 years ago
TestServiceGeographUk.php
9 years ago
TestServiceGettyImages.php
9 years ago
TestServiceGfycat.php
9 years ago
TestServiceGithubGist.php
9 years ago
TestServiceGmep.php
9 years ago
TestServiceHq23.php
9 years ago
TestServiceHuffduffer.php
9 years ago
TestServiceHulu.php
9 years ago
TestServiceIFTTT.php
9 years ago
TestServiceIFixIt.php
9 years ago
TestServiceInfogram.php
9 years ago
TestServiceInstagram.php
9 years ago
TestServiceIssuu.php
9 years ago
TestServiceIssuuFakeResponse.php
9 years ago
TestServiceKickstarter.php
9 years ago
TestServiceLearningApps.php
9 years ago
TestServiceMeetup.php
9 years ago
TestServiceMixCloud.php
9 years ago
TestServiceMobyPicture.php
9 years ago
TestServiceNFB.php
9 years ago
TestServiceOfficeMix.php
9 years ago
TestServiceOfficialFM.php
9 years ago
TestServiceOumy.php
9 years ago
TestServicePastery.php
9 years ago
TestServicePollDaddy.php
9 years ago
TestServicePollEverywhere.php
9 years ago
TestServicePortfolium.php
9 years ago
TestServiceRapidengage.php
9 years ago
TestServiceRdio.php
9 years ago
TestServiceReleaseWire.php
9 years ago
TestServiceRepubHub.php
9 years ago
TestServiceReverbnation.php
9 years ago
TestServiceRevision3.php
9 years ago
TestServiceRoomshare.php
9 years ago
TestServiceRutube.php
9 years ago
TestServiceSapo.php
9 years ago
TestServiceScreenr.php
9 years ago
TestServiceScribd.php
9 years ago
TestServiceShortNote.php
9 years ago
TestServiceShoudio.php
9 years ago
TestServiceShowTheWay.php
9 years ago
TestServiceSilk.php
9 years ago
TestServiceSketchfab.php
9 years ago
TestServiceSlideshare.php
9 years ago
TestServiceSoundCloud.php
9 years ago
TestServiceSpeakerDeck.php
9 years ago
TestServiceSpotify.php
9 years ago
TestServiceSway.php
9 years ago
TestServiceTed.php
9 years ago
TestServiceTheySaidSo.php
9 years ago
TestServiceTwitter.php
9 years ago
TestServiceUstream.php
9 years ago
TestServiceVerse.php
9 years ago
TestServiceViddler.php
9 years ago
TestServiceVideoFork.php
9 years ago
TestServiceVideoJug.php
9 years ago
TestServiceVimeo.php
9 years ago
TestServiceVine.php
9 years ago
TestServiceWordpressTV.php
9 years ago
TestServiceYFrog.php
9 years ago
TestServiceYandex.php
9 years ago
TestServiceYoutube.php
9 years ago
TestUrl.php
9 years ago
TestFakeResponse.php
102 lines
| 1 | <?php |
| 2 | /** |
| 3 | * TestFakeResponse.php |
| 4 | * |
| 5 | * @package Tests |
| 6 | * @author Michael Pratt <pratt@hablarmierda.net> |
| 7 | * @link http://www.michael-pratt.com/ |
| 8 | * |
| 9 | * For the full copyright and license information, please view the LICENSE |
| 10 | * file that was distributed with this source code. |
| 11 | */ |
| 12 | |
| 13 | class TestFakeResponse extends PHPUnit_Framework_TestCase |
| 14 | { |
| 15 | public function testResponse() |
| 16 | { |
| 17 | $config = array( |
| 18 | 'fake' => array( |
| 19 | 'width' => 420, |
| 20 | 'height' => 315 |
| 21 | ), |
| 22 | 'params' => array( |
| 23 | 'maxwidth' => 0, |
| 24 | 'maxheight' => 0, |
| 25 | ) |
| 26 | ); |
| 27 | |
| 28 | $response = array( |
| 29 | 'provider_name' => 'a provider name', |
| 30 | 'html' => '<div style="height:{height}px;width:{width}px">hi</div>' |
| 31 | ); |
| 32 | |
| 33 | $fakeResponse = new \Embera\FakeResponse($config, $response); |
| 34 | $response = $fakeResponse->buildResponse(); |
| 35 | |
| 36 | $this->assertEquals($response['width'], 420); |
| 37 | $this->assertEquals($response['height'], 315); |
| 38 | $this->assertEquals($response['html'], '<div style="height:315px;width:420px">hi</div>'); |
| 39 | $this->assertEquals($response['version'], '1.0'); |
| 40 | $this->assertEquals($response['url'], ''); |
| 41 | } |
| 42 | |
| 43 | public function testResponse2() |
| 44 | { |
| 45 | $config = array( |
| 46 | 'fake' => array( |
| 47 | 'width' => 420, |
| 48 | 'height' => 315 |
| 49 | ), |
| 50 | 'params' => array( |
| 51 | 'maxwidth' => 500, |
| 52 | ) |
| 53 | ); |
| 54 | |
| 55 | $response = array( |
| 56 | 'provider_name' => 'a provider name', |
| 57 | 'html' => '<div style="height:{height}px;width:{width}px">hi</div>' |
| 58 | ); |
| 59 | |
| 60 | $fakeResponse = new \Embera\FakeResponse($config, $response); |
| 61 | $response = $fakeResponse->buildResponse(); |
| 62 | |
| 63 | $this->assertEquals($response['width'], 500); |
| 64 | $this->assertEquals($response['height'], 315); |
| 65 | $this->assertEquals($response['html'], '<div style="height:315px;width:500px">hi</div>'); |
| 66 | $this->assertEquals($response['version'], '1.0'); |
| 67 | $this->assertEquals($response['url'], ''); |
| 68 | } |
| 69 | |
| 70 | public function testResponse3() |
| 71 | { |
| 72 | $config = array( |
| 73 | 'fake' => array( |
| 74 | 'width' => 500, |
| 75 | 'height' => 315, |
| 76 | 'url' => 'http://hi.com', |
| 77 | 'thumb' => 'http://image.com' |
| 78 | ), |
| 79 | 'params' => array( |
| 80 | 'maxwidth' => 210, |
| 81 | ) |
| 82 | ); |
| 83 | |
| 84 | $response = array( |
| 85 | 'provider_name' => 'a provider name', |
| 86 | 'html' => '<div style="height:{height}px;width:{width}px">hi</div>' |
| 87 | ); |
| 88 | |
| 89 | $fakeResponse = new \Embera\FakeResponse($config, $response); |
| 90 | $response = $fakeResponse->buildResponse(); |
| 91 | |
| 92 | $this->assertEquals($response['width'], 500); |
| 93 | $this->assertEquals($response['height'], 315); |
| 94 | $this->assertEquals($response['html'], '<div style="height:315px;width:500px">hi</div>'); |
| 95 | $this->assertEquals($response['version'], '1.0'); |
| 96 | $this->assertEquals($response['url'], 'http://hi.com'); |
| 97 | $this->assertEquals($response['thumb'], 'http://image.com'); |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | ?> |
| 102 |