/** * @return void */ public function testSave() { $captcha = $this->Captchas->newEntity(['result' => 3, 'ip' => '127.0.0.1', 'session_id' => 1, 'created' => new DateTime('- 1 hour'), 'modified' => new DateTime('- 1 hour')]); $result = $this->Captchas->save($captcha); $this->assertTrue((bool) $result); $id = $captcha->id; $data = ['comment' => 'Foo']; $comment = $this->Comments->newEntity($data); $res = $this->Comments->save($comment); $this->assertFalse((bool) $res); $data['captcha_id'] = $id; $data['captcha_result'] = 2; $data['email_homepage'] = ''; $comment = $this->Comments->newEntity($data); $res = $this->Comments->save($comment); $this->assertFalse((bool) $res); $data['captcha_result'] = 3; $data['email_homepage'] = ''; $comment = $this->Comments->newEntity($data); $res = $this->Comments->save($comment); $this->assertTrue((bool) $res); $captcha = $this->Captchas->get($id); $this->assertNotEmpty($captcha->used); }
/** * @return void */ public function testGet() { $hashid = 'jR'; $address = $this->Addresses->get($hashid); $this->assertSame($hashid, $address->id); }