ここの情報は古いです。ご理解頂いた上でお取り扱いください。

Changeset 12855


Ignore:
Timestamp:
Sep 8, 2009, 8:15:19 PM (13 years ago)
Author:
fukamachi
Message:

db converter - added testBlacklist()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE3/branches/fukamachi/db-convert-from-2.x/lib/task/openpneUpgradeFrom2Task.class.php

    r12851 r12855  
    2727
    2828  private $memoryBuf           = 0;
     29  private $adminPassword       = null;
    2930
    3031  protected function configure()
     
    12111212
    12121213  /**
    1213    * Tests method
     1214   * Tests
    12141215   */
    12151216  protected function testInitialize($app = 'pc_frontend')
     
    12221223      sfContext::createInstance($configuration);
    12231224    }
    1224   }
    1225 
    1226   protected function testAdminUser()
    1227   {
    1228     $adminUser = $this->selectOne('AdminUser', 1);
    1229     $this->testInitialize('pc_backend');
    1230     $user = $this->createTestUser();
    1231 
    1232     $password = $this->ask('Please input administrator\'s password.');
     1225
     1226    $this->connectTo3();
     1227  }
     1228
     1229  protected function loginAdminUser($user)
     1230  {
     1231    $adminUser = $this->selectOne('AdminUser');
     1232
     1233    if (is_null($this->adminPassword))
     1234    {
     1235      $this->adminPassword = $this->ask('Please input the administrator\'s password.');
     1236    }
    12331237
    12341238    $params = array('admin_user' => array(
    1235       'username' => $adminUser->getUsername(),
    1236       'password' => $password,
     1239      'username' => $adminUser->getUsername,
     1240      'password' => $this->adminPassword,
    12371241    ));
     1242    $this->_login($user, '/default/login', $params);
     1243  }
     1244
     1245  // TODO: how to know the user's password?
     1246  protected function loginUser($user, $mailAddress, $password)
     1247  {
     1248    $params = array('authMailAddress' => array(
     1249      'mail_address' => $mailAddress,
     1250      'password'     => $password,
     1251    ));
     1252    $this->_login($user, '/member/login/authMode/MailAddress', $params);
     1253  }
     1254
     1255  protected function _login($user, $path = '', $params)
     1256  {
    12381257    $user->
    1239       post('/default/login', $params)->
     1258      post($path, $params)->
    12401259      isRedirected()->
    12411260      with('request')->begin()->
     
    12441263      end()
    12451264    ;
     1265  }
     1266
     1267  protected function testAdminUser()
     1268  {
     1269    $this->testInitialize('pc_backend');
     1270    $this->loginAdminUser($this->createTestUser());
     1271  }
     1272
     1273  protected function testBlacklist()
     1274  {
     1275    if ($blacklist = $this->selectOne('Blacklist'))
     1276    {
     1277      $this->testInitialize('pc_backend');
     1278      $user = $this->loginAdminUser($this->createTestUser());
     1279
     1280      // TODO
     1281    }
    12461282  }
    12471283
Note: See TracChangeset for help on using the changeset viewer.