Ejemplo n.º 1
0
 public function testValidation()
 {
     $this->assertThrown('TipyValidationException', "Post should belongs to user", function () {
         $post = new BlogPost();
         $post->title = 'This is a title';
         $post->message = 'This is a message!';
         $post->save();
         $this->assertEqual($post->isNewRecord(), true);
         $this->assertEqual($post->id, null);
         $post->userId = 2;
         $this->assertEqual($post->save(), true);
         $this->assertEqual($post->isNewRecord(), false);
         $this->assertNotEqual($post->id, null);
     });
 }