Browse Source

Testing experiments.

Frederic G. MARAND 10 years ago
parent
commit
fdd7a2cd28
4 changed files with 57 additions and 3 deletions
  1. 6 3
      .gitignore
  2. 13 0
      OSInet/Testable/Foo.php
  3. 35 0
      OSInet/Testable/Tests/FooTest.php
  4. 3 0
      apps/testable/testable.php

+ 6 - 3
.gitignore

@@ -4,11 +4,14 @@
 .settings
 
 # PhpStorm project files
+# WebStorm project files
 .idea
 
 # PHP error logs
 php_error*
 
-# Library components
-OSInet
-
+# Other library components
+OSInet/Class_Grapher
+OSInet/Finite_State_Machine
+OSInet/Open_Document
+OSInet/Sort

+ 13 - 0
OSInet/Testable/Foo.php

@@ -0,0 +1,13 @@
+<?php
+namespace OSInet\Testable;
+
+class Foo {
+  public function call($url, $args) {
+
+  }
+
+  public function __construct($manager, $client) {
+
+  }
+}
+

+ 35 - 0
OSInet/Testable/Tests/FooTest.php

@@ -0,0 +1,35 @@
+<?php
+namespace OSInet\Testable;
+
+require_once "misc/psr0.php";
+spl_autoload_register('psr0_autoload');
+
+class FooTest extends \PHPUnit_Framework_TestCase{
+  /**
+   * @var \OSInet\Testable\Foo
+   */
+  public $foo;
+
+  /**
+   * @var \OSInet\Testable\Foo
+   */
+  public $foo2;
+  /**
+   * Prepares the environment before running a test.
+   */
+  protected function setUp() {
+    parent::setUp();
+    $this->foo = $this->getMock('OSInet\Testable\Foo', NULL, array('bar', 'qux'));
+    $rc = new \ReflectionClass($this->foo);
+    print_r($rc->getMethods());
+
+    $this->foo2 = $this->getMockBuilder('OSInet\Testable\Foo')
+      ->getMock();
+    $rc = new \ReflectionClass($this->foo2);
+    print_r($rc->getMethods());
+  }
+
+  public function testCall() {
+    $this->foo->call('http://example.com', array('system.listMethods', array()));
+  }
+}

+ 3 - 0
apps/testable/testable.php

@@ -0,0 +1,3 @@
+<?php
+
+$x = new Foo(NULL, NULL);