Permalink
Browse files

converted the whole project to namespaced PHP

  • Loading branch information...
1 parent 8d5b3b9 commit 380d4cf489bcbcbd77668838b26ec66a2478013b Jonathan Moss committed Apr 19, 2011
Showing with 598 additions and 629 deletions.
  1. +2 −2 build.xml
  2. +4 −4 integration-tests/TestComposeMany.php
  3. +4 −4 integration-tests/TestComposeOne.php
  4. +6 −6 integration-tests/TestFileProperty.php
  5. +4 −4 integration-tests/TestHasMany.php
  6. +4 −4 integration-tests/TestHasOne.php
  7. +11 −11 integration-tests/TestQuery.php
  8. +4 −4 integration-tests/TestSingleObject.php
  9. +8 −8 integration-tests/{MongoUnit → mongoUnit}/JsonLoader.php
  10. +17 −17 integration-tests/{MongoUnit → mongoUnit}/TestCase.php
  11. +5 −4 integration-tests/{MongoUnit/Constraint → mongoUnit/constraint}/CollectionDoesNotExist.php
  12. +6 −5 integration-tests/{MongoUnit/Constraint → mongoUnit/constraint}/CollectionExists.php
  13. +6 −4 integration-tests/{MongoUnit/Constraint → mongoUnit/constraint}/DocumentExists.php
  14. +6 −5 integration-tests/{MongoUnit/Constraint → mongoUnit/constraint}/DocumentPropertyEquals.php
  15. +4 −4 integration-tests/test-objects/Child.php
  16. +3 −3 integration-tests/test-objects/ComposeManyParent.php
  17. +3 −3 integration-tests/test-objects/ComposeOneParent.php
  18. +3 −3 integration-tests/test-objects/HasManyParent.php
  19. +3 −3 integration-tests/test-objects/HasOneParent.php
  20. +3 −3 integration-tests/test-objects/User.php
  21. +26 −26 src/bootstrap.php
  22. +16 −16 src/{Morph → morph}/Collection.php
  23. +4 −4 src/{Morph → morph}/Enum.php
  24. +3 −3 src/{Morph → morph}/ICompare.php
  25. +2 −2 src/{Morph → morph}/IQuery.php
  26. +7 −7 src/{Morph → morph}/Iterator.php
  27. +47 −47 src/{Morph → morph}/Object.php
  28. +9 −9 src/{Morph → morph}/PropertySet.php
  29. +3 −3 src/{Morph → morph}/Query.php
  30. +48 −48 src/{Morph → morph}/Storage.php
  31. +8 −8 src/{Morph → morph}/Utils.php
  32. +4 −4 src/{Morph/Compare → morph/compare}/NumericProperty.php
  33. +3 −3 src/{Morph/Compare → morph/compare}/Property.php
  34. +2 −2 src/{Morph/Exception → morph/exception}/ObjectNotFound.php
  35. +3 −16 src/{Morph/Property → morph/property}/Boolean.php
  36. +17 −17 src/{Morph/Property → morph/property}/ComposeMany.php
  37. +13 −13 src/{Morph/Property → morph/property}/ComposeOne.php
  38. +11 −25 src/{Morph/Property → morph/property}/Date.php
  39. +10 −10 src/{Morph/Property → morph/property}/Enum.php
  40. +22 −22 src/{Morph/Property → morph/property}/File.php
  41. +11 −11 src/{Morph/Property → morph/property}/Float.php
  42. +9 −9 src/{Morph/Property → morph/property}/Generic.php
  43. +27 −27 src/{Morph/Property → morph/property}/HasMany.php
  44. +26 −26 src/{Morph/Property → morph/property}/HasOne.php
  45. +11 −11 src/{Morph/Property → morph/property}/Integer.php
  46. +8 −8 src/{Morph/Property → morph/property}/String.php
  47. +13 −13 src/{Morph/Query → morph/query}/Property.php
  48. +4 −5 unit-tests/ForTesting.php
  49. +27 −27 unit-tests/TestObject.php
  50. +20 −20 unit-tests/TestPropertySet.php
  51. +16 −17 unit-tests/TestQuery.php
  52. +12 −20 unit-tests/TestUtils.php
  53. +8 −8 unit-tests/UnitTests.php
  54. +1 −1 unit-tests/namespaced_stub.php
  55. +19 −18 unit-tests/{Property → property}/TestProperties.php
  56. +22 −22 unit-tests/{Query → query}/TestProperty.php
View
@@ -7,11 +7,11 @@
<fileset dir="integration-tests" id="integration-tests">
<include name="**/Test*.php" />
- <exclude name="MongoUnit/*" />
+ <exclude name="mongoUnit/*" />
<exclude name="IntegrationsTests.php" />
</fileset>
- <fileset dir="src/Morph" id="classes">
+ <fileset dir="src/morph" id="classes">
<include name="**/*.php" />
</fileset>
@@ -6,26 +6,26 @@
*/
require_once dirname(__FILE__).'/../Morph.phar';
-require_once dirname(__FILE__).'/MongoUnit/TestCase.php';
+require_once dirname(__FILE__).'/mongoUnit/TestCase.php';
require_once dirname(__FILE__).'/test-objects/ComposeManyParent.php';
require_once dirname(__FILE__).'/test-objects/Child.php';
/**
* @package Morph
*/
-class TestComposeMany extends MongoUnit_TestCase
+class TestComposeMany extends \mongoUnit\TestCase
{
public function setup()
{
parent::setUp();
- Morph_Storage::init($this->getDatabase());
+ \morph\Storage::init($this->getDatabase());
}
public function tearDown()
{
parent::tearDown();
- Morph_Storage::deInit();
+ \morph\Storage::deInit();
}
public function testStoresParentAndChild()
@@ -6,26 +6,26 @@
*/
require_once dirname(__FILE__).'/../Morph.phar';
-require_once dirname(__FILE__).'/MongoUnit/TestCase.php';
+require_once dirname(__FILE__).'/mongoUnit/TestCase.php';
require_once dirname(__FILE__).'/test-objects/ComposeOneParent.php';
require_once dirname(__FILE__).'/test-objects/Child.php';
/**
* @package Morph
*/
-class TestComposeOne extends MongoUnit_TestCase
+class TestComposeOne extends \mongoUnit\TestCase
{
public function setup()
{
parent::setup();
- Morph_Storage::init($this->getDatabase());
+ \morph\Storage::init($this->getDatabase());
}
public function tearDown()
{
parent::tearDown();
- Morph_Storage::deInit();
+ \morph\Storage::deInit();
}
public function testStoresParentAndChild()
@@ -6,25 +6,25 @@
*/
require_once dirname(__FILE__).'/../Morph.phar';
-require_once dirname(__FILE__).'/MongoUnit/TestCase.php';
+require_once dirname(__FILE__).'/mongoUnit/TestCase.php';
require_once dirname(__FILE__).'/test-objects/User.php';
/**
* @package Morph
*/
-class TestFileProperty extends MongoUnit_TestCase
+class TestFileProperty extends \mongoUnit\TestCase
{
public function setup()
{
parent::setup();
- Morph_Storage::init($this->getDatabase());
+ \morph\Storage::init($this->getDatabase());
}
public function tearDown()
{
parent::tearDown();
- Morph_Storage::deInit();
+ \morph\Storage::deInit();
unlink('test.png');
}
@@ -38,8 +38,8 @@ public function testStoresUserAndFile()
$this->assertDocumentExists('User', $user->id());
$user->Avatar->write("test.png");
$this->assertFileExists('test.png');
- $originalFileHash = md5_file(dirname(__FILE__).'/fixtures/flask.png');
- $retrievedFileHash = md5_file('test.png');
+ $originalFileHash = \md5_file(dirname(__FILE__).'/fixtures/flask.png');
+ $retrievedFileHash = \md5_file('test.png');
$this->assertEquals($originalFileHash, $retrievedFileHash);
}
@@ -6,26 +6,26 @@
*/
require_once dirname(__FILE__).'/../Morph.phar';
-require_once dirname(__FILE__).'/MongoUnit/TestCase.php';
+require_once dirname(__FILE__).'/mongoUnit/TestCase.php';
require_once dirname(__FILE__).'/test-objects/HasManyParent.php';
require_once dirname(__FILE__).'/test-objects/Child.php';
/**
* @package Morph
*/
-class TestHasMany extends MongoUnit_TestCase
+class TestHasMany extends \mongoUnit\TestCase
{
public function setup()
{
parent::setup();
- Morph_Storage::init($this->getDatabase());
+ \morph\Storage::init($this->getDatabase());
}
public function tearDown()
{
parent::tearDown();
- Morph_Storage::deInit();
+ \morph\Storage::deInit();
}
public function testStoresParentAndChildren()
@@ -6,26 +6,26 @@
*/
require_once dirname(__FILE__).'/../Morph.phar';
-require_once dirname(__FILE__).'/MongoUnit/TestCase.php';
+require_once dirname(__FILE__).'/mongoUnit/TestCase.php';
require_once dirname(__FILE__).'/test-objects/HasOneParent.php';
require_once dirname(__FILE__).'/test-objects/Child.php';
/**
* @package Morph
*/
-class TestHasOne extends MongoUnit_TestCase
+class TestHasOne extends \mongoUnit\TestCase
{
public function setup()
{
parent::setup();
- Morph_Storage::init($this->getDatabase());
+ \morph\Storage::init($this->getDatabase());
}
public function tearDown()
{
parent::tearDown();
- Morph_Storage::deInit();
+ \morph\Storage::deInit();
}
public function testStoresParentAndChild()
@@ -6,33 +6,33 @@
*/
require_once dirname(__FILE__).'/../Morph.phar';
-require_once dirname(__FILE__).'/MongoUnit/TestCase.php';
+require_once dirname(__FILE__).'/mongoUnit/TestCase.php';
require_once dirname(__FILE__).'/test-objects/Child.php';
/**
* @package Morph
*/
-class TestQuery extends MongoUnit_TestCase
+class TestQuery extends \mongoUnit\TestCase
{
public function setup()
{
parent::setup();
- Morph_Storage::init($this->getDatabase());
+ \morph\Storage::init($this->getDatabase());
//load data from file to query against
$this->loadJsonFileDatasetIntoCollection('Child', dirname(__FILE__). '/fixtures/children.json');
}
public function tearDown()
{
parent::tearDown();
- Morph_Storage::deInit();
+ \morph\Storage::deInit();
}
public function testCanFindByValue()
{
$child = new Child();
- $query = new Morph_Query();
+ $query = new \morph\Query();
$query->property('Name')->equals('a_musing_moose');
$results = $child->findByQuery($query);
$this->assertEquals(1, $results->totalCount());
@@ -41,7 +41,7 @@ public function testCanFindByValue()
public function testCanFindByRegex()
{
$child = new Child();
- $query = new Morph_Query();
+ $query = new \morph\Query();
$query->property('Name')->regex('/.*moose.*/i');
$results = $child->findByQuery($query);
$this->assertEquals(4, $results->totalCount());
@@ -50,7 +50,7 @@ public function testCanFindByRegex()
public function testCanFindByLike()
{
$child = new Child();
- $query = new Morph_Query();
+ $query = new \morph\Query();
$query->property('Name')->like('moose');
$results = $child->findByQuery($query);
$this->assertEquals(4, $results->totalCount());
@@ -59,7 +59,7 @@ public function testCanFindByLike()
public function testCanFindByGreaterThan()
{
$child = new Child();
- $query = new Morph_Query();
+ $query = new \morph\Query();
$query->property('Age')->greaterThan(22);
$results = $child->findByQuery($query);
$this->assertEquals(2, $results->totalCount());
@@ -68,7 +68,7 @@ public function testCanFindByGreaterThan()
public function testCanFindByLessThan()
{
$child = new Child();
- $query = new Morph_Query();
+ $query = new \morph\Query();
$query->property('Age')->lessThan(22);
$results = $child->findByQuery($query);
$this->assertEquals(2, $results->totalCount());
@@ -77,7 +77,7 @@ public function testCanFindByLessThan()
public function testCanFindBetween()
{
$child = new Child();
- $query = new Morph_Query();
+ $query = new \morph\Query();
$query->property('Age')->greaterThan(22)->lessThan(40);
$results = $child->findByQuery($query);
$this->assertEquals(1, $results->totalCount());
@@ -86,7 +86,7 @@ public function testCanFindBetween()
public function testCanFindByNotValue()
{
$child = new Child();
- $query = new Morph_Query();
+ $query = new \morph\Query();
$query->property('Name')->notEqualTo('a_musing_moose');
$results = $child->findByQuery($query);
$this->assertEquals(3, $results->totalCount());
@@ -6,25 +6,25 @@
*/
require_once dirname(__FILE__).'/../Morph.phar';
-require_once dirname(__FILE__).'/MongoUnit/TestCase.php';
+require_once dirname(__FILE__).'/mongoUnit/TestCase.php';
require_once dirname(__FILE__).'/test-objects/Child.php';
/**
* @package Morph
*/
-class TestSingleObject extends MongoUnit_TestCase
+class TestSingleObject extends \mongoUnit\TestCase
{
public function setup()
{
parent::setup();
- Morph_Storage::init($this->getDatabase());
+ \morph\Storage::init($this->getDatabase());
}
public function tearDown()
{
parent::tearDown();
- Morph_Storage::deInit();
+ \morph\Storage::deInit();
}
public function testStoresObject()
@@ -5,43 +5,43 @@
* @copyright 2010 Tangent Labs
* @version SVN: $Id$
*/
-
+namespace mongoUnit;
/**
* Loads data into a collection
*
* @package MongoUnit
*/
-class MongoUnit_JsonLoader
+class JsonLoader
{
private $collection;
- public function __construct(MongoCollection $collection)
+ public function __construct(\MongoCollection $collection)
{
$this->collection = $collection;
}
public function loadFromJsonFile($filePath)
{
- if (!file_exists($filePath)) {
+ if (!\file_exists($filePath)) {
throw new InvalidArgumentException("Could not locate $filePath");
}
- $json = file_get_contents($filePath);
+ $json = \file_get_contents($filePath);
return $this->loadJsonFromString($json);
}
public function loadJsonFromString($json)
{
if (!$this->isValidJson($json)) {
- throw new InvalidArgumentException("Invalid Json");
+ throw new \InvalidArgumentException("Invalid Json");
}
- $data = json_decode($json, true);
+ $data = \json_decode($json, true);
$this->collection->drop();
return $this->collection->batchInsert($data);
}
private function isValidJson($json)
{
- return (json_decode($json) !== null) ? true : false;
+ return (\json_decode($json) !== null) ? true : false;
}
}
Oops, something went wrong.

0 comments on commit 380d4cf

Please sign in to comment.