Page MenuHomeDevCentral

D200.diff
No OneTemporary

D200.diff

diff --git a/composer.json b/composer.json
--- a/composer.json
+++ b/composer.json
@@ -34,10 +34,11 @@
},
"autoload": {
"psr-4": {
- "Keruald\\Broker\\": "src/"
+ "Keruald\\Broker\\": "src/",
+ "Keruald\\Broker\\Tests\\": "tests/"
}
},
"scripts": {
- "test": "phpunit tests"
+ "test": "php vendor/bin/phpunit"
}
}
diff --git a/phpunit.xml b/phpunit.xml
new file mode 100644
--- /dev/null
+++ b/phpunit.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<phpunit backupGlobals="false"
+ backupStaticAttributes="false"
+ bootstrap="vendor/autoload.php"
+ colors="true"
+ convertErrorsToExceptions="true"
+ convertNoticesToExceptions="true"
+ convertWarningsToExceptions="true"
+ processIsolation="false"
+ stopOnFailure="false">
+ <testsuites>
+ <testsuite name="Application Test Suite">
+ <directory>./tests/</directory>
+ </testsuite>
+ </testsuites>
+ <filter>
+ <whitelist>
+ <directory suffix=".php">src/</directory>
+ </whitelist>
+ </filter>
+</phpunit>
diff --git a/tests/AMQPBrokerTest.php b/tests/AMQPBrokerTest.php
--- a/tests/AMQPBrokerTest.php
+++ b/tests/AMQPBrokerTest.php
@@ -1,8 +1,10 @@
<?php
+namespace Keruald\Broker\Tests;
+
use Keruald\Broker\AMQPBroker;
-class AMQPBrokerTest extends PHPUnit_Framework_TestCase {
+class AMQPBrokerTest extends TestCase {
/**
* @var Keruald\Broker\AMQPBroker
*/
@@ -27,31 +29,4 @@
$methodsCascade
);
}
-
- /**
- * Asserts the specified object follows a method cascading pattern
- *
- * @param object $instance the object to tests
- * @param Array $methodsCascade an array, each item an array following the call_user_func_array format
- */
- protected function assertMethodCascading ($instance, $methodsCascade) {
- //We determine the type of the object when first passed
- //to our test, then we call one par one each method,
- //each time verifying the returned type is still the same
-
- $type = get_class($instance);
-
- foreach ($methodsCascade as $method) {
- $methodName = array_shift($method);
- $instance = call_user_func_array(
- [$instance, $methodName],
- $method
- );
- $this->assertInstanceOf(
- $type,
- $instance,
- "$type::$methodName should return \$this"
- );
- }
- }
}
diff --git a/tests/TestCase.php b/tests/TestCase.php
new file mode 100644
--- /dev/null
+++ b/tests/TestCase.php
@@ -0,0 +1,33 @@
+<?php
+
+namespace Keruald\Broker\Tests;
+
+class TestCase extends \PHPUnit_Framework_TestCase {
+ /**
+ * Asserts the specified object follows a method cascading pattern
+ *
+ * @param object $instance The object to tests
+ * @param array $methodsCascade An array, each item an array following the
+ * call_user_func_array format
+ */
+ protected function assertMethodCascading ($instance, $methodsCascade) {
+ // We determine the type of the object when first passed
+ // to our test, then we call one par one each method,
+ // each time verifying the returned type is still the same.
+
+ $type = get_class($instance);
+
+ foreach ($methodsCascade as $method) {
+ $methodName = array_shift($method);
+ $instance = call_user_func_array(
+ [$instance, $methodName],
+ $method
+ );
+ $this->assertInstanceOf(
+ $type,
+ $instance,
+ "$type::$methodName should return \$this"
+ );
+ }
+ }
+}

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 17, 13:22 (21 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2249418
Default Alt Text
D200.diff (3 KB)

Event Timeline