Ejemplo n.º 1
0
 public function testCreatePost()
 {
     $obj = json_decode($this->user_sample);
     // Casts a stdObject to the type passed in the second argument
     $user = AopTestUtils::cast($obj, 'Models\\User');
     // when post->save() is invoked return true
     AopMocker::mock('Models\\Post', 'save', true);
     // when User::getUser() is called the sample user will be returned
     AopMocker::mock('Models\\User', 'getUser', $user);
     $result = Post::createPost($user->_id, "Test", "This is a test post !", array("test", "unit"));
     $this->assertTrue($result >= 0);
 }
Ejemplo n.º 2
0
 public function testCreateUser()
 {
     AopMocker::mock("Models\\User", "save", true);
     $res = User::createUser(array('name' => 'Ahmad Hajjar', 'email' => '*****@*****.**', 'password' => '12345678'));
     $this->assertNotFalse($res);
 }