Simplify bootstrap for tests
This commit is contained in:
parent
8dddf56c2e
commit
909353ea39
|
@ -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);
|
||||||
|
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -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.
|
||||||
|
|
|
@ -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';
|
||||||
|
|
|
@ -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';
|
|
||||||
|
|
Loading…
Reference in New Issue