Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3768970
D200.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D200.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 24, 11:46 (9 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2260110
Default Alt Text
D200.diff (3 KB)
Attached To
Mode
D200: Organize Keruald\Broker\Tests namespace
Attached
Detach File
Event Timeline
Log In to Comment