]> granicus.if.org Git - php/commitdiff
Test ReflectionZendExtension class
authorDmitry Stogov <dmitry@zend.com>
Mon, 5 Mar 2018 08:51:58 +0000 (11:51 +0300)
committerJoe Watkins <krakjoe@php.net>
Fri, 9 Mar 2018 11:07:52 +0000 (12:07 +0100)
ext/reflection/tests/ReflectionZendExtension.phpt [new file with mode: 0644]
ext/reflection/tests/ReflectionZendExtension_error.phpt [new file with mode: 0644]

diff --git a/ext/reflection/tests/ReflectionZendExtension.phpt b/ext/reflection/tests/ReflectionZendExtension.phpt
new file mode 100644 (file)
index 0000000..b4cd96e
--- /dev/null
@@ -0,0 +1,23 @@
+--TEST--
+Test ReflectionZendExtension class
+--CREDITS--
+Gabriel Caruso (carusogabriel34@gmail.com)
+--SKIPIF--
+<?php if(!extension_loaded('Zend OPcache')) die('skip Zend OPcache extension not loaded'); ?>
+--FILE--
+<?php
+$reflection = new ReflectionZendExtension('Zend OPcache');
+var_dump($reflection->getAuthor());
+var_dump($reflection->getCopyright());
+var_dump($reflection->getName());
+var_dump($reflection->getURL());
+var_dump($reflection->getVersion() === PHP_VERSION);
+var_dump(gettype($reflection->export('Zend OPcache', true)) === 'string');
+?>
+--EXPECTF--
+string(17) "Zend Technologies"
+string(23) "Copyright (c) 1999-20%d"
+string(12) "Zend OPcache"
+string(20) "http://www.zend.com/"
+bool(true)
+bool(true)
diff --git a/ext/reflection/tests/ReflectionZendExtension_error.phpt b/ext/reflection/tests/ReflectionZendExtension_error.phpt
new file mode 100644 (file)
index 0000000..efce026
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Test ReflectionZendExtension class erros
+--CREDITS--
+Gabriel Caruso (carusogabriel34@gmail.com)
+--SKIPIF--
+<?php if(!extension_loaded('Zend OPcache')) die('skip Zend OPcache extension not loaded'); ?>
+--FILE--
+<?php
+try {
+    new ReflectionZendExtension('zend_opcache');
+} catch (ReflectionException $e) {
+    echo $e->getMessage();
+}
+
+?>
+--EXPECT--
+Zend Extension zend_opcache does not exist