integrate web test case
This commit is contained in:
@@ -36,7 +36,8 @@
|
||||
"swiftmailer/swiftmailer": "5.0.*",
|
||||
"symfony/serializer": "2.3.*",
|
||||
"ensepar/html2pdf": "1.0.1",
|
||||
"symfony/finder": "~2.2"
|
||||
"symfony/finder": "~2.2",
|
||||
"symfony/browser-kit": "2.3.*"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "4.1.*",
|
||||
|
||||
114
composer.lock
generated
114
composer.lock
generated
@@ -4,7 +4,7 @@
|
||||
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"hash": "73a6895063dd76bcb25eb14ef329e745",
|
||||
"hash": "e6d2af4c5536d0187aa2515baa3c62ab",
|
||||
"packages": [
|
||||
{
|
||||
"name": "doctrine/cache",
|
||||
@@ -704,6 +704,63 @@
|
||||
],
|
||||
"time": "2013-03-25 15:02:40"
|
||||
},
|
||||
{
|
||||
"name": "symfony/browser-kit",
|
||||
"version": "v2.3.13",
|
||||
"target-dir": "Symfony/Component/BrowserKit",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/BrowserKit.git",
|
||||
"reference": "97563874c24b65ea8d31b82fe051a161caf83e10"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/BrowserKit/zipball/97563874c24b65ea8d31b82fe051a161caf83e10",
|
||||
"reference": "97563874c24b65ea8d31b82fe051a161caf83e10",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3",
|
||||
"symfony/dom-crawler": "~2.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/css-selector": "~2.0",
|
||||
"symfony/process": "~2.0"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony/process": ""
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.3-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Symfony\\Component\\BrowserKit\\": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com",
|
||||
"homepage": "http://fabien.potencier.org",
|
||||
"role": "Lead Developer"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "http://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony BrowserKit Component",
|
||||
"homepage": "http://symfony.com",
|
||||
"time": "2014-04-18 20:35:25"
|
||||
},
|
||||
{
|
||||
"name": "symfony/class-loader",
|
||||
"version": "v2.2.6",
|
||||
@@ -903,6 +960,61 @@
|
||||
"homepage": "http://symfony.com",
|
||||
"time": "2013-07-21 09:38:59"
|
||||
},
|
||||
{
|
||||
"name": "symfony/dom-crawler",
|
||||
"version": "v2.4.4",
|
||||
"target-dir": "Symfony/Component/DomCrawler",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/DomCrawler.git",
|
||||
"reference": "e94b29c7cac964e58c406408d238ceeaa3604e78"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/DomCrawler/zipball/e94b29c7cac964e58c406408d238ceeaa3604e78",
|
||||
"reference": "e94b29c7cac964e58c406408d238ceeaa3604e78",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/css-selector": "~2.0"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony/css-selector": ""
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.4-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Symfony\\Component\\DomCrawler\\": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com",
|
||||
"homepage": "http://fabien.potencier.org",
|
||||
"role": "Lead Developer"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "http://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony DomCrawler Component",
|
||||
"homepage": "http://symfony.com",
|
||||
"time": "2014-04-18 20:37:09"
|
||||
},
|
||||
{
|
||||
"name": "symfony/event-dispatcher",
|
||||
"version": "v2.2.6",
|
||||
|
||||
59
core/lib/Thelia/Tests/WebTestCase.php
Normal file
59
core/lib/Thelia/Tests/WebTestCase.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* This file is part of the Thelia package. */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : dev@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE.txt */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Tests;
|
||||
|
||||
use Thelia\Core\Thelia;
|
||||
|
||||
|
||||
/**
|
||||
* Class WebTestCase
|
||||
* @package Thelia\Tests
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class WebTestCase extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @var \Thelia\Core\Thelia
|
||||
*/
|
||||
protected static $kernel;
|
||||
|
||||
/**
|
||||
* @param array $options
|
||||
* @param array $server
|
||||
* @return \Symfony\Component\HttpKernel\Client
|
||||
*/
|
||||
protected static function createClient(array $options = [], array $server = [])
|
||||
{
|
||||
if (null !== static::$kernel) {
|
||||
static::$kernel->shutdown();
|
||||
}
|
||||
|
||||
static::$kernel = new Thelia('test', true);
|
||||
static::$kernel->boot();
|
||||
|
||||
$client = static::$kernel->getContainer()->get('test.client');
|
||||
$client->setServerParameters($server);
|
||||
|
||||
return $client;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shuts the kernel down if it was used in the test.
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
if (null !== static::$kernel) {
|
||||
static::$kernel->shutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
* @file
|
||||
* Functions needed for Thelia bootstrap
|
||||
*/
|
||||
ini_set('session.use_cookies', 0);
|
||||
$env = "test";
|
||||
require_once __DIR__ . '/../../../bootstrap.php';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user