Skip to content

Commit 9dd8782

Browse files
committed
Add functional app test (fix #29)
1 parent d492312 commit 9dd8782

File tree

6 files changed

+74
-3
lines changed

6 files changed

+74
-3
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespace FOS\HttpCacheBundle\Tests\Functional\Fixtures\Controller;
4+
5+
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
6+
use Symfony\Component\HttpFoundation\Response;
7+
8+
class TestController extends Controller
9+
{
10+
public function testAction()
11+
{
12+
return new Response('hello');
13+
}
14+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
3+
use Symfony\Component\Config\Loader\LoaderInterface;
4+
use Symfony\Component\HttpKernel\Kernel;
5+
6+
class AppKernel extends Kernel
7+
{
8+
/**
9+
* {@inheritdoc}
10+
*/
11+
public function registerBundles()
12+
{
13+
return array(
14+
new \Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
15+
new \Symfony\Bundle\MonologBundle\MonologBundle(),
16+
new \FOS\HttpCacheBundle\FOSHttpCacheBundle(),
17+
);
18+
}
19+
20+
/**
21+
* {@inheritdoc}
22+
*/
23+
public function registerContainerConfiguration(LoaderInterface $loader)
24+
{
25+
$loader->load(__DIR__.'/config/config.yml');
26+
}
27+
28+
/**
29+
* {@inheritdoc}
30+
*/
31+
public function getCacheDir()
32+
{
33+
return sys_get_temp_dir().'/fos/cache';
34+
}
35+
36+
/**
37+
* {@inheritdoc}
38+
*/
39+
public function getLogDir()
40+
{
41+
return sys_get_temp_dir().'/fos/logs';
42+
}
43+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
framework:
2+
secret: fos
3+
router:
4+
resource: "%kernel.root_dir%/config/routing.yml"
5+
test: ~
6+
7+
fos_http_cache:
8+
varnish:
9+
ips: 192.168.0.1
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
test:
2+
pattern: /test
3+
defaults: { _controller: FOS\HttpCacheBundle\Tests\Functional\Fixtures\Controller\TestController::testAction }

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@
3131
"mockery/mockery": "0.8.*",
3232
"monolog/monolog": "*",
3333
"sensio/framework-extra-bundle": "~2.3",
34-
"symfony/console": "~2.3",
34+
"symfony/symfony": "~2.3",
3535
"symfony/security": "~2.3",
36-
"symfony/expression-language": "~2.4"
36+
"symfony/expression-language": "~2.4",
37+
"symfony/monolog-bundle": "~2.3"
3738
},
3839
"suggest": {
3940
"guzzle/http": "For sending invalidation requests",

phpunit.xml.dist

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
</filter>
2929

3030
<listeners>
31-
<listener class="\Mockery\Adapter\Phpunit\TestListener"></listener>
31+
<listener class="\Mockery\Adapter\Phpunit\TestListener" />
3232
<listener class="\FOS\HttpCacheBundle\Tests\Functional\WebServerListener">
3333
<arguments>
3434
<string>functional</string>
@@ -37,6 +37,7 @@
3737
</listeners>
3838

3939
<php>
40+
<server name="KERNEL_DIR" value="./Tests/Functional/Fixtures/app" />
4041
<const name="WEB_SERVER_HOST" value="localhost" />
4142
<const name="WEB_SERVER_PORT" value="8000" />
4243
<const name="WEB_SERVER_DOCROOT" value="./Tests/Functional/Fixtures/web" />

0 commit comments

Comments
 (0)