/** * Tests whether testimonial status have the correct string representation */ public function testGetStatusString() { $repr = Testimonial::getStatusMap(); $testimonial1 = $this->testimonials('testimonial1'); $this->assertEquals($repr[$testimonial1->status], $testimonial1->getStatusString()); $testimonial2 = $this->testimonials('testimonial2'); $this->assertEquals($repr[$testimonial2->status], $testimonial2->getStatusString()); $testimonial3 = $this->testimonials('testimonial3'); $this->assertEquals($repr[$testimonial3->status], $testimonial3->getStatusString()); }
/** * A filter to ensure only new testimonial can be updated. * @param CFilterChain $filterChain the filter chain */ public function filterCheckNewStatus($filterChain) { if (isset($_GET['id'])) { $model = $this->loadModel($_GET['id']); if ($model->status != Testimonial::STATUS_NEW && $model->status != Testimonial::STATUS_REJECTED) { $statusMap = Testimonial::getStatusMap(); throw new CHttpException(403, 'Testimoni ini statusnya bukan "' . $statusMap[Testimonial::STATUS_NEW] . '" atau "' . $statusMap[Testimonial::STATUS_REJECTED] . '".'); } } $filterChain->run(); }