summaryrefslogtreecommitdiff
path: root/vendor/ruflin/elastica/test/lib/Elastica/Test/Exception/AbstractExceptionTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/ruflin/elastica/test/lib/Elastica/Test/Exception/AbstractExceptionTest.php')
-rw-r--r--vendor/ruflin/elastica/test/lib/Elastica/Test/Exception/AbstractExceptionTest.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/vendor/ruflin/elastica/test/lib/Elastica/Test/Exception/AbstractExceptionTest.php b/vendor/ruflin/elastica/test/lib/Elastica/Test/Exception/AbstractExceptionTest.php
new file mode 100644
index 00000000..ea84218a
--- /dev/null
+++ b/vendor/ruflin/elastica/test/lib/Elastica/Test/Exception/AbstractExceptionTest.php
@@ -0,0 +1,31 @@
+<?php
+namespace Elastica\Test\Exception;
+
+use Elastica\Test\Base as BaseTest;
+
+abstract class AbstractExceptionTest extends BaseTest
+{
+ protected function _getExceptionClass()
+ {
+ $reflection = new \ReflectionObject($this);
+
+ // Elastica\Test\Exception\RuntimeExceptionTest => Elastica\Exception\RuntimeExceptionTest
+ $name = preg_replace('/^Elastica\\\\Test/', 'Elastica', $reflection->getName());
+
+ // Elastica\Exception\RuntimeExceptionTest => Elastica\Exception\RuntimeException
+ $name = preg_replace('/Test$/', '', $name);
+
+ return $name;
+ }
+
+ /**
+ * @group unit
+ */
+ public function testInheritance()
+ {
+ $className = $this->_getExceptionClass();
+ $reflection = new \ReflectionClass($className);
+ $this->assertTrue($reflection->isSubclassOf('Exception'));
+ $this->assertTrue($reflection->implementsInterface('Elastica\Exception\ExceptionInterface'));
+ }
+}