Skip to content

Commit

Permalink
Adding tests for the two new methods in Collection
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Dec 26, 2013
1 parent 2ddd2d3 commit b1b2424
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions Cake/Test/TestCase/Utility/CollectionTest.php
Expand Up @@ -474,4 +474,27 @@ public function testSample() {
$this->assertContains($value, $data);
}
}

/**
* Test toArray method
*
* @return void
*/
public function testToArray() {
$data = [1, 2, 3, 4];
$collection = new Collection($data);
$this->assertEquals($data, $collection->toArray());
}

/**
* Test json enconding
*
* @return void
*/
public function testToJson() {
$data = [1, 2, 3, 4];
$collection = new Collection($data);
$this->assertEquals(json_encode($data), json_encode($collection));
}

}

0 comments on commit b1b2424

Please sign in to comment.