-
Notifications
You must be signed in to change notification settings - Fork 258
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
8fe8c1f
commit 592b1db
Showing
12 changed files
with
162 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace Hautelook\AliceBundle\Tests\Functional; | ||
|
||
use Symfony\Component\Config\Loader\LoaderInterface; | ||
use Symfony\Component\HttpKernel\Kernel; | ||
|
||
class AppKernel extends Kernel | ||
{ | ||
public function registerBundles() | ||
{ | ||
return array( | ||
new \Symfony\Bundle\FrameworkBundle\FrameworkBundle(), | ||
new \Hautelook\AliceBundle\HautelookAliceBundle(), | ||
|
||
new \Hautelook\AliceBundle\Tests\Functional\TestBundle\TestBundle(), | ||
); | ||
} | ||
|
||
public function getCacheDir() | ||
{ | ||
return sys_get_temp_dir().'/AliceBundle/'; | ||
} | ||
|
||
public function registerContainerConfiguration(LoaderInterface $loader) | ||
{ | ||
$loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml'); | ||
} | ||
} |
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,27 @@ | ||
<?php | ||
|
||
namespace Hautelook\AliceBundle\Tests\Functional\Command; | ||
|
||
use Doctrine\Bundle\FixturesBundle\Command\LoadDataFixturesDoctrineCommand; | ||
use Hautelook\AliceBundle\Tests\Functional\TestCase; | ||
use Symfony\Bundle\FrameworkBundle\Console\Application; | ||
use Symfony\Component\Console\Tester\CommandTester; | ||
use Symfony\Component\Finder\Shell\Command; | ||
|
||
class DoctrineFixtureTest extends TestCase | ||
{ | ||
public function testFixture() | ||
{ | ||
$application = new Application(self::getKernel()); | ||
$application->add(new LoadDataFixturesDoctrineCommand()); | ||
$command = $application->find('doctrine:fixtures:load'); | ||
// $command = new \Symfony\Component\Console\Command\Command(); | ||
|
||
$commandTester = new CommandTester($command); | ||
$commandTester->execute(array()); | ||
|
||
$display = $commandTester->getDisplay(); | ||
|
||
var_dump($display); | ||
} | ||
} |
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,14 @@ | ||
<?php | ||
|
||
namespace Hautelook\AliceBundle\Tests\Functional; | ||
|
||
/** | ||
* @group functional | ||
*/ | ||
class ControllerTest extends TestCase | ||
{ | ||
public function testServiceSetup() | ||
{ | ||
$client = $this->createClient(); | ||
} | ||
} |
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,15 @@ | ||
<?php | ||
|
||
namespace Hautelook\AliceBundle\Tests\Functional\TestBundle\Controller; | ||
|
||
use Symfony\Bundle\FrameworkBundle\Controller\Controller; | ||
use Symfony\Component\HttpFoundation\Response; | ||
use Symfony\Component\HttpFoundation\Request; | ||
|
||
class RootController extends Controller | ||
{ | ||
public function testAction(Request $request) | ||
{ | ||
return new Response("TestResponse"); | ||
} | ||
} |
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 @@ | ||
services: |
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,9 @@ | ||
<?php | ||
|
||
namespace Hautelook\AliceBundle\Tests\Functional\TestBundle; | ||
|
||
use Symfony\Component\HttpKernel\Bundle\Bundle; | ||
|
||
class TestBundle extends Bundle | ||
{ | ||
} |
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,44 @@ | ||
<?php | ||
|
||
namespace Hautelook\AliceBundle\Tests\Functional; | ||
|
||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; | ||
use Symfony\Component\Filesystem\Filesystem; | ||
|
||
abstract class TestCase extends WebTestCase | ||
{ | ||
protected static function createKernel(array $options = array()) | ||
{ | ||
$env = @$options['environment'] ?: 'test'; | ||
|
||
return new AppKernel($env, true); | ||
} | ||
|
||
protected static function initializeKernel(array $options = array()) | ||
{ | ||
if (null !== static::$kernel) { | ||
return; | ||
} | ||
|
||
static::$kernel = static::createKernel($options); | ||
static::$kernel->boot(); | ||
} | ||
|
||
protected static function getKernel() | ||
{ | ||
static::initializeKernel(); | ||
|
||
return static::$kernel; | ||
} | ||
|
||
protected function setUp() | ||
{ | ||
$fs = new Filesystem(); | ||
$fs->remove(sys_get_temp_dir().'/AliceBundle/'); | ||
} | ||
|
||
protected function tearDown() | ||
{ | ||
static::$kernel = null; | ||
} | ||
} |
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,10 @@ | ||
imports: | ||
- { resource: "@TestBundle/Resources/config/services.yml" } | ||
|
||
framework: | ||
secret: test | ||
router: | ||
resource: "%kernel.root_dir%/config/routing.yml" | ||
form: ~ | ||
validation: ~ | ||
session: ~ |
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,5 @@ | ||
imports: | ||
- { resource: config.yml } | ||
|
||
framework: | ||
test: ~ |
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,4 @@ | ||
api_root: | ||
pattern: /test | ||
defaults: | ||
_controller: TestBundle:Root:test |
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