-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from Happyr/tests
Added functional tests to make sure the bundle compiles
- Loading branch information
Showing
9 changed files
with
123 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
language: php | ||
|
||
php: | ||
- 5.4 | ||
- 5.5 | ||
- 5.6 | ||
- 7.0 | ||
|
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,59 @@ | ||
<?php | ||
|
||
namespace Happyr\TranslationBundle\tests\Functional; | ||
|
||
use Http\HttplugBundle\HttplugBundle; | ||
use Symfony\Component\Config\Loader\LoaderInterface; | ||
use Symfony\Component\Filesystem\Filesystem; | ||
use Symfony\Component\HttpKernel\Kernel; | ||
|
||
class AppKernel extends Kernel | ||
{ | ||
private $config; | ||
|
||
public function __construct($config) | ||
{ | ||
parent::__construct('test', true); | ||
|
||
$fs = new Filesystem(); | ||
if (!$fs->isAbsolutePath($config)) { | ||
$config = __DIR__.'/config/'.$config; | ||
} | ||
|
||
if (!file_exists($config)) { | ||
throw new \RuntimeException(sprintf('The config file "%s" does not exist.', $config)); | ||
} | ||
|
||
$this->config = $config; | ||
} | ||
|
||
public function registerBundles() | ||
{ | ||
return array( | ||
new \Symfony\Bundle\FrameworkBundle\FrameworkBundle(), | ||
new \Symfony\Bundle\SecurityBundle\SecurityBundle(), | ||
new \Happyr\TranslationBundle\HappyrTranslationBundle(), | ||
new \Http\HttplugBundle\HttplugBundle(), | ||
); | ||
} | ||
|
||
public function registerContainerConfiguration(LoaderInterface $loader) | ||
{ | ||
$loader->load($this->config); | ||
} | ||
|
||
public function getCacheDir() | ||
{ | ||
return sys_get_temp_dir().'/HappyrTranslationBundle'; | ||
} | ||
|
||
public function serialize() | ||
{ | ||
return $this->config; | ||
} | ||
|
||
public function unserialize($config) | ||
{ | ||
$this->__construct($config); | ||
} | ||
} |
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,13 @@ | ||
<?php | ||
|
||
namespace Happyr\TranslationBundle\tests\Functional; | ||
|
||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; | ||
|
||
class BaseTestCase extends WebTestCase | ||
{ | ||
protected static function createKernel(array $options = array()) | ||
{ | ||
return new AppKernel(isset($options['config']) ? $options['config'] : 'default.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,21 @@ | ||
<?php | ||
|
||
namespace Happyr\TranslationBundle\tests\Functional; | ||
|
||
class BundleInitializationTest extends BaseTestCase | ||
{ | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function bundle_will_install_with_no_errors() | ||
{ | ||
$client = static::createClient(); | ||
$container = $client->getContainer(); | ||
$container->get('happyr.translation.service.loco'); | ||
$container->get('happyr.translation.service.blackhole'); | ||
$container->get('happyr.translation.service.filesystem'); | ||
} | ||
|
||
|
||
} |
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,3 @@ | ||
imports: | ||
- { resource: framework.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,18 @@ | ||
framework: | ||
secret: test | ||
test: ~ | ||
session: | ||
storage_id: session.storage.mock_file | ||
form: false | ||
csrf_protection: false | ||
validation: | ||
enabled: false | ||
router: | ||
resource: "%kernel.root_dir%/config/routing.yml" | ||
|
||
httplug: | ||
classes: | ||
client: Http\Adapter\Guzzle6\Client | ||
message_factory: Http\Message\MessageFactory\GuzzleMessageFactory | ||
uri_factory: Http\Message\UriFactory\GuzzleUriFactory | ||
stream_factory: Http\Message\StreamFactory\GuzzleStreamFactory |
Empty file.