示例#1
0
 public function testAfterGetList()
 {
     $dummyResult = array(0 => array("id" => 1, "content" => "this is a content", "created" => "2014-01-01 00:00:00", "author" => "Foo"), 1 => array("id" => 2, "content" => "this is another content", "created" => "2013-01-01 00:00:00", "author" => "Bar"));
     $expectedResult = array(0 => array("id" => 1, "content" => "this is a content", "date" => "2014-01-01 00:00:00", "author" => "Foo"), 1 => array("id" => 2, "content" => "this is another content", "date" => "2013-01-01 00:00:00", "author" => "Bar"));
     $nbResult = count($dummyResult);
     $result = $this->postDecorator->afterGetList($dummyResult);
     $this->assertCount(2, $result, "Provided results should now be wrapped in a array of size 2");
     $this->assertEquals($expectedResult, $result["posts"], "'posts' should be set to the provided results and 'created' dimension should now be 'date'");
     $this->assertEquals($nbResult, $result["count"], "count should be the length of provided results");
 }