Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
127 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
src/Symfony/Component/Asset/Tests/Context/NullContextTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\Asset\Tests\Context; | ||
|
||
use Symfony\Component\Asset\Context\NullContext; | ||
|
||
class NullContextTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
public function testGetBasePath() | ||
{ | ||
$nullContext = new NullContext(); | ||
|
||
$this->assertEmpty($nullContext->getBasePath()); | ||
} | ||
|
||
public function testIsSecure() | ||
{ | ||
$nullContext = new NullContext(); | ||
|
||
$this->assertFalse($nullContext->isSecure()); | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
src/Symfony/Component/Asset/Tests/Context/RequestStackContextTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\Asset\Tests\Context; | ||
|
||
use Symfony\Component\Asset\Context\RequestStackContext; | ||
|
||
class RequestStackContextTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
public function testGetBasePathEmpty() | ||
{ | ||
$requestStack = $this->getMock('Symfony\Component\HttpFoundation\RequestStack'); | ||
$requestStackContext = new RequestStackContext($requestStack); | ||
|
||
$this->assertEmpty($requestStackContext->getBasePath()); | ||
} | ||
|
||
public function testGetBasePathSet() | ||
{ | ||
$testBasePath = 'test-path'; | ||
|
||
$request = $this->getMock('Symfony\Component\HttpFoundation\Request'); | ||
$request->method('getBasePath') | ||
->willReturn($testBasePath); | ||
$requestStack = $this->getMock('Symfony\Component\HttpFoundation\RequestStack'); | ||
$requestStack->method('getMasterRequest') | ||
->willReturn($request); | ||
|
||
$requestStackContext = new RequestStackContext($requestStack); | ||
|
||
$this->assertEquals($testBasePath, $requestStackContext->getBasePath()); | ||
} | ||
|
||
public function testIsSecureFalse() | ||
{ | ||
$requestStack = $this->getMock('Symfony\Component\HttpFoundation\RequestStack'); | ||
$requestStackContext = new RequestStackContext($requestStack); | ||
|
||
$this->assertFalse($requestStackContext->isSecure()); | ||
} | ||
|
||
public function testIsSecureTrue() | ||
{ | ||
$request = $this->getMock('Symfony\Component\HttpFoundation\Request'); | ||
$request->method('isSecure') | ||
->willReturn(true); | ||
$requestStack = $this->getMock('Symfony\Component\HttpFoundation\RequestStack'); | ||
$requestStack->method('getMasterRequest') | ||
->willReturn($request); | ||
|
||
$requestStackContext = new RequestStackContext($requestStack); | ||
|
||
$this->assertTrue($requestStackContext->isSecure()); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
src/Symfony/Component/Asset/Tests/VersionStrategy/EmptyVersionStrategyTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\Asset\Tests\VersionStrategy; | ||
|
||
use Symfony\Component\Asset\VersionStrategy\EmptyVersionStrategy; | ||
|
||
class EmptyVersionStrategyTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
public function testGetVersion() | ||
{ | ||
$emptyVersionStrategy = new EmptyVersionStrategy(); | ||
$path = 'test-path'; | ||
|
||
$this->assertEmpty($emptyVersionStrategy->getVersion($path)); | ||
} | ||
|
||
public function testApplyVersion() | ||
{ | ||
$emptyVersionStrategy = new EmptyVersionStrategy(); | ||
$path = 'test-path'; | ||
|
||
$this->assertEquals($path, $emptyVersionStrategy->applyVersion($path)); | ||
} | ||
} |