1
0
mirror of https://github.com/php/php-src.git synced 2026-04-29 11:13:36 +02:00

Merge branch 'PHP-7.4'

This commit is contained in:
Fabien Villepinte
2019-10-21 21:17:50 +02:00
3 changed files with 70 additions and 0 deletions
@@ -0,0 +1,25 @@
--TEST--
ReflectionZendExtension: basic tests for accessors
--SKIPIF--
<?php
$zendExtensions = get_loaded_extensions(true);
if (!in_array('Zend OPcache', $zendExtensions)) {
die('SKIP the Zend OPcache extension not available');
}
?>
--FILE--
<?php
$rze = new ReflectionZendExtension('Zend OPcache');
var_dump($rze->getName());
var_dump($rze->getVersion() === PHP_VERSION);
var_dump($rze->getAuthor());
var_dump($rze->getURL());
var_dump($rze->getCopyright());
?>
--EXPECT--
string(12) "Zend OPcache"
bool(true)
string(17) "Zend Technologies"
string(20) "http://www.zend.com/"
string(13) "Copyright (c)"
@@ -0,0 +1,12 @@
--TEST--
ReflectionZendExtension: error with invalid extension name
--FILE--
<?php
try {
new ReflectionZendExtension('foo-bar-baz');
} catch (ReflectionException $e) {
echo $e->getMessage();
}
?>
--EXPECT--
Zend Extension foo-bar-baz does not exist
@@ -0,0 +1,33 @@
--TEST--
ReflectionZendExtension: basic test for __toString()
--SKIPIF--
<?php
$zendExtensions = get_loaded_extensions(true);
if (!in_array('Zend OPcache', $zendExtensions)) {
die('SKIP the Zend OPcache extension not available');
}
?>
--FILE--
<?php
$rze = new ReflectionZendExtension('Zend OPcache');
$str = (string)$rze;
$methods = [
'getName',
'getVersion',
'getAuthor',
'getURL',
'getCopyright',
];
foreach ($methods as $method) {
$prop = $rze->{$method}();
if (strpos($str, $prop) === false) {
echo "The result of $method() ($prop) is not found in: $str\n";
}
}
?>
===DONE===
--EXPECT--
===DONE===