migrate to php8

This commit is contained in:
ivan shalganov
2023-02-23 21:50:12 +01:00
parent b04c38a533
commit e8647cfb02
6 changed files with 40 additions and 14 deletions

View File

@@ -241,7 +241,7 @@ class TestCase extends \PHPUnit\Framework\TestCase
);
}
public function providerVariables()
public static function providerVariables()
{
return array(
array('$one', 1),
@@ -334,6 +334,13 @@ class Helper
public function getArray() {
return array(1,2,3);
}
/**
* @throws \Exception
*/
public static function throws() {
throw new \Exception("helper exception");
}
}
function helper_func($string, $pad = 10) {

View File

@@ -44,14 +44,9 @@ class RenderTest extends TestCase
$this->assertSame("It is render's function fetch", self::$render->fetch(array("render" => "fetch")));
}
/**
* @expectedException \RuntimeException
* @expectedExceptionMessage template error
*/
public function testFetchException()
{
$this->expectException(\RuntimeException::class);
$this->expectExceptionMessage("template error");
$this->expectException(Fenom\Error\TemplateException::class);
$render = new Render(Fenom::factory("."), function () {
echo "error";
throw new \RuntimeException("template error");

View File

@@ -24,7 +24,7 @@ class FenomTest extends \Fenom\TestCase
$time = $this->tpl('temp.tpl', 'Template 1 a');
$fenom = new Fenom($provider = new \Fenom\Provider(FENOM_RESOURCES . '/template'));
$fenom->setCompileDir(FENOM_RESOURCES . '/compile');
$this->assertInstanceOf('Fenom\Template', $tpl = $fenom->getTemplate('temp.tpl'));
$this->assertInstanceOf('Fenom\Render', $tpl = $fenom->getTemplate('temp.tpl'));
$this->assertSame($provider, $tpl->getProvider());
$this->assertSame('temp.tpl', $tpl->getBaseName());
$this->assertSame('temp.tpl', $tpl->getName());
@@ -40,7 +40,7 @@ class FenomTest extends \Fenom\TestCase
FENOM_RESOURCES . '/compile',
Fenom::AUTO_ESCAPE
);
$this->assertInstanceOf('Fenom\Template', $tpl = $fenom->getTemplate('temp.tpl'));
$this->assertInstanceOf('Fenom\Render', $tpl = $fenom->getTemplate('temp.tpl'));
$this->assertSame($provider, $tpl->getProvider());
$this->assertSame('temp.tpl', $tpl->getBaseName());
$this->assertSame('temp.tpl', $tpl->getName());