Ejemplo n.º 1
0
 /**
  * Creates the user and rights group tables, adds a user into both as
  * admin, then adds that user to the session.
  *
  * @since 2.0
  */
 protected function setUp()
 {
     $_POST = array();
     $_GET = array();
     $_COOKIE = array();
     $config = ConfigProvider::getInstance();
     $config->set('session.provider.name', 'Alpha\\Util\\Http\\Session\\SessionProviderArray');
     $action = new ActionLog();
     $action->rebuildTable();
     $person = new Person();
     $person->rebuildTable();
     $rights = new Rights();
     $rights->rebuildTable();
     $rights->set('name', 'Standard');
     $rights->save();
     $rights = new Rights();
     $rights->set('name', 'Admin');
     $rights->save();
     $person = $this->createPersonObject('loggedin');
     $person->save();
     if (!$person->inGroup('Admin')) {
         $adminGroup = new Rights();
         $adminGroup->loadByAttribute('name', 'Admin');
         $lookup = $adminGroup->getMembers()->getLookup();
         $lookup->setValue(array($person->getID(), $adminGroup->getID()));
         $lookup->save();
     }
     $sessionProvider = $config->get('session.provider.name');
     $session = SessionProviderFactory::getInstance($sessionProvider);
     $session->set('currentUser', $person);
 }
Ejemplo n.º 2
0
 /**
  * Set up tests.
  *
  * @since 2.0
  */
 protected function setUp()
 {
     $config = ConfigProvider::getInstance();
     $config->set('session.provider.name', 'Alpha\\Util\\Http\\Session\\SessionProviderArray');
     $tag = new Tag();
     $tag->rebuildTable();
     $denum = new DEnum();
     $denum->rebuildTable();
     $item = new DEnumItem();
     $item->rebuildTable();
     $article = new Article();
     $article->rebuildTable();
     $articleVote = new ArticleVote();
     $articleVote->rebuildTable();
     $articleComment = new ArticleComment();
     $articleComment->rebuildTable();
     $person = new Person();
     $person->rebuildTable();
     $rights = new Rights();
     $rights->rebuildTable();
     $rights->set('name', 'Standard');
     $rights->save();
     $rights = new Rights();
     $rights->set('name', 'Admin');
     $rights->save();
 }
 /**
  * Set up tests.
  *
  * @since 2.0
  */
 protected function setUp()
 {
     $config = ConfigProvider::getInstance();
     $config->set('session.provider.name', 'Alpha\\Util\\Http\\Session\\SessionProviderArray');
     $standardGroup = new Rights();
     $standardGroup->rebuildTable();
     $standardGroup->set('name', 'Standard');
     $standardGroup->save();
     $person = new Person();
     $person->set('displayName', 'unittestuser');
     $person->set('email', '*****@*****.**');
     $person->set('password', 'password');
     $person->rebuildTable();
     $person->save();
     $article = new Article();
     $article->set('title', 'unit test');
     $article->set('description', 'unit test');
     $article->set('content', 'unit test');
     $article->set('author', 'unit test');
     $article->rebuildTable();
     $article->save();
     $comment = new ArticleComment();
     $comment->set('content', 'unit test');
     $comment->getPropObject('articleOID')->setValue($article->getOID());
     $comment->rebuildTable();
     $comment->save();
 }
Ejemplo n.º 4
0
 /**
  * Set up tests.
  *
  * @since 2.0
  */
 protected function setUp()
 {
     $config = ConfigProvider::getInstance();
     $config->set('session.provider.name', 'Alpha\\Util\\Http\\Session\\SessionProviderArray');
     $person = new Person();
     $person->rebuildTable();
     $rights = new Rights();
     $rights->rebuildTable();
     $rights->set('name', 'Standard');
     $rights->save();
 }
Ejemplo n.º 5
0
 /**
  * Called before the test functions will be executed
  * this function is defined in PHPUnit_TestCase and overwritten
  * here.
  *
  * @since 1.0
  */
 protected function setUp()
 {
     parent::setUp();
     $this->enum1 = new Enum();
     $rights = new Rights();
     $rights->rebuildTable();
     $this->person = new Person();
     $this->person->set('displayName', 'enumunittest');
     $this->person->set('email', '*****@*****.**');
     $this->person->set('password', 'password');
     $this->person->rebuildTable();
     $this->person->save();
 }
Ejemplo n.º 6
0
 /**
  * Called before the test functions will be executed
  * this function is defined in PHPUnit_TestCase and overwritten
  * here.
  *
  * @since 1.2.1
  */
 protected function setUp()
 {
     parent::setUp();
     $rights = new Rights();
     $rights->rebuildTable();
     $standardGroup = new Rights();
     $standardGroup->set('name', 'Standard');
     $standardGroup->save();
     $person = new Person();
     $person->rebuildTable();
     $article = new Article();
     $article->rebuildTable();
 }
Ejemplo n.º 7
0
 /**
  * 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');
 }
Ejemplo n.º 8
0
 /**
  * Called before the test functions will be executed
  * this function is defined in PHPUnit_TestCase and overwritten
  * here.
  *
  * @since 1.0
  */
 protected function setUp()
 {
     parent::setUp();
     $this->rel1 = new Relation();
     $rights = new Rights();
     $rights->rebuildTable();
     $article = new Article();
     $article->rebuildTable();
     $comment = new ArticleComment();
     $comment->rebuildTable();
     $standardGroup = new Rights();
     $standardGroup->set('name', 'Standard');
     $standardGroup->save();
     $this->person = new Person();
     $this->person->set('displayName', 'unittestuser');
     $this->person->set('email', '*****@*****.**');
     $this->person->set('password', 'password');
     $this->person->rebuildTable();
     $this->person->save();
 }
Ejemplo n.º 9
0
 /**
  * Set up tests.
  *
  * @since 2.0
  */
 protected function setUp()
 {
     $config = ConfigProvider::getInstance();
     $config->set('session.provider.name', 'Alpha\\Util\\Http\\Session\\SessionProviderArray');
     $action = new ActionLog();
     $action->rebuildTable();
     $tag = new Tag();
     $tag->rebuildTable();
     $denum = new DEnum();
     $denum->rebuildTable();
     $item = new DEnumItem();
     $item->rebuildTable();
     // create a default article DEnum category
     $denum = new DEnum('Alpha\\Model\\Article::section');
     $item->set('value', 'Main');
     $item->set('DEnumID', $denum->getID());
     $item->save();
     $article = new Article();
     $article->rebuildTable();
     $articleVote = new ArticleVote();
     $articleVote->rebuildTable();
     $articleComment = new ArticleComment();
     $articleComment->rebuildTable();
     $person = new Person();
     $person->rebuildTable();
     $rights = new Rights();
     $rights->rebuildTable();
     $rights->set('name', 'Standard');
     $rights->save();
     $rights = new Rights();
     $rights->set('name', 'Admin');
     $rights->save();
 }
Ejemplo n.º 10
0
 /**
  * Set up tests.
  *
  * @since 1.0
  */
 protected function setUp()
 {
     $config = ConfigProvider::getInstance();
     $config->set('session.provider.name', 'Alpha\\Util\\Http\\Session\\SessionProviderArray');
     $tag = new Tag();
     $tag->rebuildTable();
     $denum = new DEnum();
     $denum->rebuildTable();
     $item = new DEnumItem();
     $item->rebuildTable();
     $article = new Article();
     $article->rebuildTable();
     $this->controller = new ImageController();
     $this->person = $this->createPersonObject('unitTestUser');
     $this->person->rebuildTable();
     $this->article = $this->createArticleObject('unitTestArticle');
     $this->article->rebuildTable();
     $this->group = new Rights();
     $this->group->rebuildTable();
     $this->group->set('name', 'Admin');
     $this->group->save();
     $this->group = new Rights();
     $this->group->set('name', 'Standard');
     $this->group->save();
     $lookup = $this->group->getMembers()->getLookup();
     $lookup->setValue('00000000001', $this->group->getOID());
     $lookup->save();
 }