Exemplo n.º 1
0
 public function testGetAllWhenThereAreNone()
 {
     Yii::app()->user->userModel = User::getByUsername('super');
     $savedCalendars = SavedCalendar::getAll();
     $this->assertEquals(0, count($savedCalendars));
 }
 public function testSuperUserDeleteAction()
 {
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     Yii::app()->user->userModel = $super;
     $calendar = CalendarTestHelper::createSavedCalendarByName("My Cal 3", '#66367b');
     //Delete a calendar
     $this->setGetArray(array('id' => $calendar->id));
     $this->resetPostArray();
     $calendars = SavedCalendar::getAll();
     $this->assertEquals(4, count($calendars));
     $this->runControllerWithNoExceptionsAndGetContent('calendars/default/delete');
     $calendars = SavedCalendar::getAll();
     $this->assertEquals(3, count($calendars));
     try {
         SavedCalendar::getById($calendar->id);
         $this->fail();
     } catch (NotFoundException $e) {
         //success
     }
 }