mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 10:24:26 +02:00
Update for PHPunit >= 5
This commit is contained in:
@@ -16,6 +16,7 @@ if (!class_exists('Smarty_Autoloader')) {
|
|||||||
throw new Exception('can not locate Smarty distribution');
|
throw new Exception('can not locate Smarty distribution');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!defined('SMARTY_COMPOSER_INSTALL')) {
|
if (!defined('SMARTY_COMPOSER_INSTALL')) {
|
||||||
foreach (array(dirname(__FILE__) . '/../../autoload.php', dirname(__FILE__) . '/../vendor/autoload.php',
|
foreach (array(dirname(__FILE__) . '/../../autoload.php', dirname(__FILE__) . '/../vendor/autoload.php',
|
||||||
dirname(__FILE__) . '/vendor/autoload.php') as $file) {
|
dirname(__FILE__) . '/vendor/autoload.php') as $file) {
|
||||||
@@ -26,15 +27,19 @@ if (!defined('SMARTY_COMPOSER_INSTALL')) {
|
|||||||
}
|
}
|
||||||
unset($file);
|
unset($file);
|
||||||
}
|
}
|
||||||
if (!class_exists('PHPUnit_Framework_TestCase') && !class_exists('\PHPUnit\Framework\TestCase')) {
|
if (!class_exists('PHPUnit_Framework_TestCase') && !class_exists('\PHPUnit\Framework\TestCase')){
|
||||||
require_once SMARTY_COMPOSER_INSTALL;
|
require_once SMARTY_COMPOSER_INSTALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!class_exists('\PHPUnit_Framework_TestCase') && class_exists('\PHPUnit\Framework\TestCase')) {
|
if (!class_exists('\PHPUnit_Framework_TestCase') && class_exists('\PHPUnit\Framework\TestCase')) {
|
||||||
class_alias('\PHPUnit\Framework\TestCase', '\PHPUnit_Framework_TestCase');
|
class_alias('\PHPUnit\Framework\TestCase', '\PHPUnit_Framework_TestCase');
|
||||||
|
class_alias('\PHPUnit\Framework\Error\Notice', '\PHPUnit_Framework_Error_Notice');
|
||||||
|
class_alias('\PHPUnit\Framework\Error\Error', '\PHPUnit_Framework_Error_Error');
|
||||||
|
class_alias('\PHPUnit\Framework\Error\Warning', '\PHPUnit_Framework_Error_Warning');
|
||||||
|
class_alias('\PHPUnit\Framework\Error\Warning', '\PHPUnit_Framework_Error_Deprecated');
|
||||||
|
class_alias('\PHPUnit\Util\Configuration', '\PHPUnit_Util_Configuration');
|
||||||
}
|
}
|
||||||
if (!class_exists('\PHPUnit_Framework_Error') && class_exists('\PHPUnit\Framework\Error')) {
|
|
||||||
class_alias('\PHPUnit\Framework\Error', '\PHPUnit_Framework_Error');
|
|
||||||
}
|
|
||||||
require_once 'PHPUnit_Smarty.php';
|
require_once 'PHPUnit_Smarty.php';
|
||||||
if (!ini_get('date.timezone')) {
|
if (!ini_get('date.timezone')) {
|
||||||
ini_set('date.timezone', 'Europe/Berlin');
|
ini_set('date.timezone', 'Europe/Berlin');
|
||||||
|
@@ -249,7 +249,8 @@ KEY `expire` (`expire`)
|
|||||||
if (is_dir(self::$cwd . '/templates_tmp')) {
|
if (is_dir(self::$cwd . '/templates_tmp')) {
|
||||||
$this->cleanDir(self::$cwd . '/templates_tmp');
|
$this->cleanDir(self::$cwd . '/templates_tmp');
|
||||||
}
|
}
|
||||||
}
|
$this->assertTrue(true);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make temporary template file
|
* Make temporary template file
|
||||||
|
@@ -61,14 +61,14 @@ class UndefinedTemplateVarTest extends PHPUnit_Smarty
|
|||||||
/**
|
/**
|
||||||
* Throw E_NOTICE message
|
* Throw E_NOTICE message
|
||||||
*
|
*
|
||||||
* @expectedException PHPUnit_Framework_Error
|
* @expectedException PHPUnit_Framework_Error_Notice
|
||||||
* @expectedExceptionMessage Undefined index: foo
|
* @expectedExceptionMessage Undefined index: foo
|
||||||
*/
|
*/
|
||||||
public function testE_Notice()
|
public function testE_Notice()
|
||||||
{
|
{
|
||||||
$e1 = error_reporting();
|
$e1 = error_reporting();
|
||||||
$this->assertEquals('undefined = ', $this->smarty->fetch('001_main.tpl'));
|
$this->assertEquals('undefined = ', $this->smarty->fetch('001_main.tpl'));
|
||||||
$e2 = error_reporting();
|
$e2 = error_reporting();
|
||||||
$this->assertEquals($e1, $e2);
|
$this->assertEquals($e1, $e2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,16 +1,24 @@
|
|||||||
<phpunit
|
<phpunit
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.5/phpunit.xsd"
|
||||||
bootstrap="Bootstrap.php"
|
bootstrap="Bootstrap.php"
|
||||||
colors="true"
|
colors="true"
|
||||||
backupGlobals="false"
|
backupGlobals="false"
|
||||||
backupStaticAttributes="true"
|
backupStaticAttributes="true"
|
||||||
|
forceCoversAnnotation="false"
|
||||||
|
mapTestClassNameToCoveredClassName="false"
|
||||||
processIsolation="false"
|
processIsolation="false"
|
||||||
convertErrorsToExceptions="true"
|
stopOnError="false"
|
||||||
convertNoticesToExceptions="true"
|
stopOnFailure="false"
|
||||||
convertWarningsToExceptions="true"
|
stopOnIncomplete="false"
|
||||||
beStrictAboutOutputDuringTests="true"
|
stopOnSkipped="false"
|
||||||
stopOnFailure="false">
|
stopOnRisky="false"
|
||||||
|
timeoutForSmallTests="1"
|
||||||
|
timeoutForMediumTests="10"
|
||||||
|
timeoutForLargeTests="60"
|
||||||
|
verbose="false">
|
||||||
|
|
||||||
<filter>
|
<filter>
|
||||||
<testsuites>
|
<testsuites>
|
||||||
<testsuite name="Smarty Test Suite">
|
<testsuite name="Smarty Test Suite">
|
||||||
<directory>UnitTests</directory>
|
<directory>UnitTests</directory>
|
||||||
@@ -29,7 +37,8 @@
|
|||||||
</whitelist>
|
</whitelist>
|
||||||
</filter>
|
</filter>
|
||||||
<logging>
|
<logging>
|
||||||
highlight="false" lowUpperBound="35" highLowerBound="70"/>
|
<log type="coverage-html" target="./coverage/report" lowUpperBound="35"
|
||||||
|
highLowerBound="70"/>
|
||||||
<log type="tap" target="TestResults.tap"/>
|
<log type="tap" target="TestResults.tap"/>
|
||||||
</logging>
|
</logging>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user