Simplify bootstrap for tests

This commit is contained in:
Adrien Crivelli 2017-01-23 15:05:41 +09:00
parent 8dddf56c2e
commit 909353ea39
No known key found for this signature in database
GPG Key ID: B182FD79DC6DE92E
5 changed files with 1 additions and 52 deletions

View File

@ -12,19 +12,8 @@ use PhpOffice\PhpSpreadsheet\Worksheet;
class AdvancedValueBinderTest extends \PHPUnit_Framework_TestCase class AdvancedValueBinderTest extends \PHPUnit_Framework_TestCase
{ {
public function setUp()
{
if (!defined('PHPSPREADSHEET_ROOT')) {
define('PHPSPREADSHEET_ROOT', APPLICATION_PATH . '/');
}
require_once PHPSPREADSHEET_ROOT . '/Bootstrap.php';
}
public function provider() public function provider()
{ {
if (!class_exists(NumberFormat::class)) {
$this->setUp();
}
$currencyUSD = NumberFormat::FORMAT_CURRENCY_USD_SIMPLE; $currencyUSD = NumberFormat::FORMAT_CURRENCY_USD_SIMPLE;
$currencyEURO = str_replace('$', '€', NumberFormat::FORMAT_CURRENCY_USD_SIMPLE); $currencyEURO = str_replace('$', '€', NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);

View File

@ -6,14 +6,6 @@ use PhpOffice\PhpSpreadsheet\Cell\DataType;
class DataTypeTest extends \PHPUnit_Framework_TestCase class DataTypeTest extends \PHPUnit_Framework_TestCase
{ {
public function setUp()
{
if (!defined('PHPSPREADSHEET_ROOT')) {
define('PHPSPREADSHEET_ROOT', APPLICATION_PATH . '/');
}
require_once PHPSPREADSHEET_ROOT . '/Bootstrap.php';
}
public function testGetErrorCodes() public function testGetErrorCodes()
{ {
$result = DataType::getErrorCodes(); $result = DataType::getErrorCodes();

View File

@ -11,14 +11,6 @@ class DefaultValueBinderTest extends \PHPUnit_Framework_TestCase
{ {
protected $cellStub; protected $cellStub;
public function setUp()
{
if (!defined('PHPSPREADSHEET_ROOT')) {
define('PHPSPREADSHEET_ROOT', APPLICATION_PATH . '/');
}
require_once PHPSPREADSHEET_ROOT . '/Bootstrap.php';
}
protected function createCellStub() protected function createCellStub()
{ {
// Create a stub for the Cell class. // Create a stub for the Cell class.

View File

@ -6,14 +6,6 @@ use PhpOffice\PhpSpreadsheet\Cell\Hyperlink;
class HyperlinkTest extends \PHPUnit_Framework_TestCase class HyperlinkTest extends \PHPUnit_Framework_TestCase
{ {
public function setUp()
{
if (!defined('PHPSPREADSHEET_ROOT')) {
define('PHPSPREADSHEET_ROOT', APPLICATION_PATH . '/');
}
require_once PHPSPREADSHEET_ROOT . '/Bootstrap.php';
}
public function testGetUrl() public function testGetUrl()
{ {
$urlValue = 'http://www.phpexcel.net'; $urlValue = 'http://www.phpexcel.net';

View File

@ -10,20 +10,4 @@ setlocale(LC_ALL, 'en_US.utf8');
// PHP 5.3 Compat // PHP 5.3 Compat
date_default_timezone_set('Europe/London'); date_default_timezone_set('Europe/London');
// Define path to application directory require_once __DIR__ . '/../src/Bootstrap.php';
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(__DIR__ . '/../src'));
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, [
realpath(APPLICATION_PATH . '/../src'),
'./',
__DIR__,
get_include_path(),
]));
if (!defined('PHPSPREADSHEET_ROOT')) {
define('PHPSPREADSHEET_ROOT', APPLICATION_PATH . '/');
}
require_once PHPSPREADSHEET_ROOT . 'Bootstrap.php';