コード例 #1
0
ファイル: UserTest.php プロジェクト: laiello/plankonindia
 /**
  * testDeleteAdminUser method
  *
  * @return void
  */
 public function testDeleteAdminUser()
 {
     $this->User->create(array('username' => 'admin_user', 'name' => 'Admin User', 'role_id' => 1, 'email' => '*****@*****.**', 'password' => 'password', 'website' => 'http://croogo.org', 'activation_key' => md5(uniqid()), 'status' => true));
     $this->User->save();
     $newAdmin = $this->User->read();
     $this->User->create(array('username' => 'another_adm', 'name' => 'Another Admin', 'role_id' => 1, 'email' => '*****@*****.**', 'password' => 'password', 'website' => 'http://croogo.org', 'activation_key' => md5(uniqid()), 'status' => true));
     $this->User->save();
     $anotherAdmin = $this->User->read();
     $this->User->deleteAll(array('NOT' => array('User.id' => array($newAdmin['User']['id'], $anotherAdmin['User']['id']))));
     $this->assertTrue($this->User->delete($newAdmin['User']['id']));
 }