Skip to content

Commit 9539097

Browse files
committed
Merge branch 'PHP-7.4'
2 parents 42f4bdb + 4194e04 commit 9539097

File tree

3 files changed

+70
-0
lines changed

3 files changed

+70
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--TEST--
2+
ReflectionZendExtension: basic tests for accessors
3+
--SKIPIF--
4+
<?php
5+
$zendExtensions = get_loaded_extensions(true);
6+
if (!in_array('Zend OPcache', $zendExtensions)) {
7+
die('SKIP the Zend OPcache extension not available');
8+
}
9+
?>
10+
--FILE--
11+
<?php
12+
$rze = new ReflectionZendExtension('Zend OPcache');
13+
14+
var_dump($rze->getName());
15+
var_dump($rze->getVersion() === PHP_VERSION);
16+
var_dump($rze->getAuthor());
17+
var_dump($rze->getURL());
18+
var_dump($rze->getCopyright());
19+
?>
20+
--EXPECT--
21+
string(12) "Zend OPcache"
22+
bool(true)
23+
string(17) "Zend Technologies"
24+
string(20) "http://www.zend.com/"
25+
string(13) "Copyright (c)"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--TEST--
2+
ReflectionZendExtension: error with invalid extension name
3+
--FILE--
4+
<?php
5+
try {
6+
new ReflectionZendExtension('foo-bar-baz');
7+
} catch (ReflectionException $e) {
8+
echo $e->getMessage();
9+
}
10+
?>
11+
--EXPECT--
12+
Zend Extension foo-bar-baz does not exist
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
--TEST--
2+
ReflectionZendExtension: basic test for __toString()
3+
--SKIPIF--
4+
<?php
5+
$zendExtensions = get_loaded_extensions(true);
6+
if (!in_array('Zend OPcache', $zendExtensions)) {
7+
die('SKIP the Zend OPcache extension not available');
8+
}
9+
?>
10+
--FILE--
11+
<?php
12+
$rze = new ReflectionZendExtension('Zend OPcache');
13+
14+
$str = (string)$rze;
15+
16+
$methods = [
17+
'getName',
18+
'getVersion',
19+
'getAuthor',
20+
'getURL',
21+
'getCopyright',
22+
];
23+
24+
foreach ($methods as $method) {
25+
$prop = $rze->{$method}();
26+
if (strpos($str, $prop) === false) {
27+
echo "The result of $method() ($prop) is not found in: $str\n";
28+
}
29+
}
30+
?>
31+
===DONE===
32+
--EXPECT--
33+
===DONE===

0 commit comments

Comments
 (0)