Skip to content

Commit

Permalink
fix the test after refactoring the CdnFacade
Browse files Browse the repository at this point in the history
related to commit #6a0ed63b22c20e3117c4e35c8b2f35e8926b4ccf
  • Loading branch information
mahmoud committed Sep 22, 2014
1 parent f3bbce6 commit 7b577a7
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions tests/Vinelab/Cdn/CdnFacadeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand All @@ -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);
}

/**
Expand Down

0 comments on commit 7b577a7

Please sign in to comment.