コード例 #1
0
ファイル: EnumTest.php プロジェクト: alphadevx/alpha
 /**
  * Called after the test functions are executed
  * this function is defined in PHPUnit_TestCase and overwritten
  * here.
  *
  * @since 1.0
  */
 protected function tearDown()
 {
     parent::tearDown();
     unset($this->enum1);
     $this->person->dropTable();
     $rights = new Rights();
     $rights->dropTable();
     $rights->dropTable('Person2Rights');
     unset($this->person);
 }
コード例 #2
0
ファイル: ActiveRecordTest.php プロジェクト: alphadevx/alpha
 /**
  * Testing that the saveHistory() method is automatically invoked when it should be.
  *
  * @since 1.2.1
  * @dataProvider getActiveRecordProviders
  */
 public function testSaveHistory($provider)
 {
     $config = ConfigProvider::getInstance();
     $config->set('db.provider.name', $provider);
     $this->person->setMaintainHistory(true);
     $this->person->rebuildTable();
     // this should result in the _history table being created
     $this->person->set('password', 'passwordhist1');
     $this->person->save();
     $this->assertEquals(1, $this->person->getHistoryCount(), 'Testing that a normal save is propegated to the history table for this class');
     $this->person->saveAttribute('password', 'passwordhist2');
     $this->assertEquals(2, $this->person->getHistoryCount(), 'Testing that an attribute save is propegated to the history table for this class');
     $this->person->dropTable('Person_history');
 }
コード例 #3
0
 /**
  * Drop the user tables and session between tests.
  *
  * @since 2.0
  */
 protected function tearDown()
 {
     $config = ConfigProvider::getInstance();
     $sessionProvider = $config->get('session.provider.name');
     $session = SessionProviderFactory::getInstance($sessionProvider);
     $session->set('currentUser', null);
     $person = new Person();
     $person->dropTable();
     $rights = new Rights();
     $rights->dropTable();
     $rights->dropTable('Person2Rights');
 }
コード例 #4
0
ファイル: RelationTest.php プロジェクト: alphadevx/alpha
 /**
  * Called after the test functions are executed
  * this function is defined in PHPUnit_TestCase and overwritten
  * here.
  *
  * @since 1.0
  */
 protected function tearDown()
 {
     parent::tearDown();
     unset($this->rel1);
     $person = new Person();
     $person->dropTable();
     $rights = new Rights();
     $rights->dropTable();
     $rights->dropTable('Person2Rights');
     $comment = new ArticleComment();
     $comment->dropTable();
     $article = new Article();
     $article->dropTable();
 }
コード例 #5
0
 /**
  * Called after the test functions are executed
  * this function is defined in PHPUnit_TestCase and overwritten
  * here.
  *
  * @since 1.0
  */
 protected function tearDown()
 {
     parent::tearDown();
     $person = new Person();
     $person->dropTable();
     $rights = new Rights();
     $rights->dropTable();
     $rights->dropTable('Person2Rights');
     $rights->dropTable('Person2Article');
     $article = new Article();
     $article->dropTable();
 }
コード例 #6
0
 /**
  * Testing the doPOST method.
  */
 public function testDoPOST()
 {
     $config = ConfigProvider::getInstance();
     $sessionProvider = $config->get('session.provider.name');
     $session = SessionProviderFactory::getInstance($sessionProvider);
     $person = new Person();
     $person->dropTable();
     $front = new FrontController();
     $controller = new LoginController();
     $securityParams = $controller->generateSecurityFields();
     $params = array('loginBut' => true, 'var1' => $securityParams[0], 'var2' => $securityParams[1], 'email' => $config->get('app.install.username'), 'password' => $config->get('app.install.password'));
     $request = new Request(array('method' => 'POST', 'URI' => '/login', 'params' => $params));
     $response = $front->process($request);
     $this->assertEquals(301, $response->getStatus(), 'Testing the doPOST method during install');
     $person->makeTable();
     $person = $this->createPersonObject('logintest');
     $person->save();
     $params = array('loginBut' => true, 'var1' => $securityParams[0], 'var2' => $securityParams[1], 'email' => '*****@*****.**', 'password' => 'passwordTest');
     $request = new Request(array('method' => 'POST', 'URI' => '/login', 'params' => $params));
     $response = $front->process($request);
     $this->assertEquals(301, $response->getStatus(), 'Testing the doPOST with correct password');
     $params['password'] = '******';
     $request = new Request(array('method' => 'POST', 'URI' => '/login', 'params' => $params));
     $response = $front->process($request);
     $this->assertEquals(200, $response->getStatus(), 'Testing the doPOST with incorrect password');
     $params = array('resetBut' => true, 'var1' => $securityParams[0], 'var2' => $securityParams[1], 'email' => '*****@*****.**');
     $request = new Request(array('method' => 'POST', 'URI' => '/login', 'params' => $params));
     $response = $front->process($request);
     $this->assertEquals(200, $response->getStatus(), 'Testing the doPOST during password reset');
     $person->reload();
     $this->assertNotEquals($person->get('password'), password_hash('passwordTest', PASSWORD_DEFAULT, ['cost' => 12]), 'Checking that the password has changed in the database');
 }
コード例 #7
0
ファイル: ControllerTest.php プロジェクト: alphadevx/alpha
 /**
  * (non-PHPdoc).
  *
  * @see alpha/lib/PEAR/PHPUnit-3.2.9/PHPUnit/Framework/PHPUnit_Framework_TestCase::tearDown()
  * @since 1.0
  */
 protected function tearDown()
 {
     $config = ConfigProvider::getInstance();
     $config->set('session.provider.name', 'Alpha\\Util\\Http\\Session\\SessionProviderArray');
     $this->controller->abort();
     $this->article->dropTable();
     unset($this->article);
     unset($this->controller);
     $this->person->dropTable();
     unset($this->person);
     $this->group->dropTable();
     $this->group->dropTable('Person2Rights');
     unset($this->group);
     $article = new Article();
     $article->dropTable();
     $tag = new Tag();
     $tag->dropTable();
     $denum = new DEnum();
     $denum->dropTable();
     $item = new DEnumItem();
     $item->dropTable();
 }