From 7b577a7cae8f9877fa51b967df21bdf12d2284db Mon Sep 17 00:00:00 2001 From: mahmoud Date: Mon, 22 Sep 2014 17:18:19 +0300 Subject: [PATCH] fix the test after refactoring the CdnFacade related to commit #6a0ed63b22c20e3117c4e35c8b2f35e8926b4ccf --- tests/Vinelab/Cdn/CdnFacadeTest.php | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/tests/Vinelab/Cdn/CdnFacadeTest.php b/tests/Vinelab/Cdn/CdnFacadeTest.php index 67d780f..a353791 100755 --- a/tests/Vinelab/Cdn/CdnFacadeTest.php +++ b/tests/Vinelab/Cdn/CdnFacadeTest.php @@ -8,8 +8,9 @@ public function setUp() { parent::setUp(); - $this->asset_path = 'public/foo/bar.php'; - $this->cdn_url = 'https://amazon.foo.bar.com'; + $this->asset_path = 'foo/bar.php'; + $this->path_path = 'public/foo/bar.php'; + $this->asset_url = 'https://bucket.s3.amazonaws.com/public/foo/bar.php'; $this->provider = M::mock('Vinelab\Cdn\Providers\AwsS3Provider'); @@ -36,14 +37,23 @@ public function tearDown() public function testAssetIsCallingUrlGenerator() { $this->provider->shouldReceive('urlGenerator') - ->with($this->asset_path) + ->once() + ->andReturn($this->asset_url); + + $result = $this->facade->asset($this->asset_path); + // assert is calling the url generator + assertEquals($result, $this->asset_url); + } + + public function testPathIsCallingUrlGenerator() + { + $this->provider->shouldReceive('urlGenerator') ->once() - ->andReturn($this->cdn_url); + ->andReturn($this->asset_url); - $result = $this->facade->asset($this->asset_path); - + $result = $this->facade->asset($this->path_path); // assert is calling the url generator - assertEquals($result, $this->cdn_url); + assertEquals($result, $this->asset_url); } /**