Browse Source

Adding tests for serializing a query to json

Jose Lorenzo Rodriguez 11 years ago
parent
commit
e9456c2d47
1 changed files with 14 additions and 0 deletions
  1. 14 0
      tests/TestCase/ORM/QueryTest.php

+ 14 - 0
tests/TestCase/ORM/QueryTest.php

@@ -1973,4 +1973,18 @@ class QueryTest extends TestCase {
 
 		$this->assertNull($article['articles_tag']);
 	}
+
+/**
+ * Tests that queries can be serialized to json to get the results
+ *
+ * @return void
+ */
+	public function testJsonSerialize() {
+		$table = TableRegistry::get('Articles');
+		$this->assertEquals(
+			json_encode($table->find()),
+			json_encode($table->find()->toArray())
+		);
+	}
+
 }