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
1 parent
c45f40e
commit f7d7783
Showing
4 changed files
with
34 additions
and
5 deletions.
There are no files selected for viewing
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
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
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
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,29 @@ | ||
<?php | ||
|
||
namespace Spatie\Varnish\Test; | ||
|
||
use Spatie\Varnish\Varnish; | ||
use PHPUnit_Framework_TestCase; | ||
|
||
class VarnishTest extends TestCase | ||
{ | ||
/** @test */ | ||
public function it_can_generate_a_ban_command_for_a_single_host() | ||
{ | ||
$expectedCommand = "sudo varnishadm -S -T 127.0.0.1: 'ban req.http.host ~ (^example.com$)'"; | ||
|
||
|
||
$this->assertEquals($expectedCommand, (new Varnish())->generateBanCommand(['example.com'])); | ||
} | ||
|
||
/** @test */ | ||
public function it_can_generate_a_ban_command_for_multiple_hosts() | ||
{ | ||
$expectedCommand = "sudo varnishadm -S -T 127.0.0.1: 'ban req.http.host ~ (^example.com$)|(^example2.com$)'"; | ||
|
||
$this->assertEquals($expectedCommand, (new Varnish())->generateBanCommand([ | ||
'example.com', | ||
'example2.com' | ||
])); | ||
} | ||
} |