<commit_before><?php
/*=========================================================================
 MIDAS Server
 Copyright (c) Kitware SAS. 26 rue <NAME>. 69100 Villeurbanne, FRANCE
 All rights reserved.
 More information http://www.kitware.com

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

         http://www.apache.org/licenses/LICENSE-2.0.txt

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
=========================================================================*/


/** index controller test*/
class IndexControllerTest extends ControllerTestCase
  {
  /** set up tests*/
  public function setUp()
    {
    $this->setupDatabase(array('default'));
    $this->enabledModules = array('visualize');
    parent::setUp();
    }

  /** test index action*/
  public function testIndexAction()
    {
    $modelLoad = new MIDAS_ModelLoader();
    $itemModel = $modelLoad->loadModel('Item');
    $groupModel = $modelLoad->loadModel('Group');
    $itempolicygroupModel = $modelLoad->loadModel('Itempolicygroup');
    $userModel = $modelLoad->loadModel('User');

    $componentLoader = new MIDAS_ComponentLoader();
    $uploadComponent = $componentLoader->loadComponent('Upload');

    $usersFile = $this->loadData('User', 'default');
    $userDao = $userModel->load($usersFile[0]->getKey());

    Zend_Registry::set('notifier', new MIDAS_Notifier(false, null));
    Zend_Registry::set('configsModules', array());
    $item = $uploadComponent->createUploadedItem($userDao, "test.png", BASE_PATH.'/tests/testfiles/search.png', null, null, '', true);
    $anonymousGroup = $groupModel->load(MIDAS_GROUP_ANONYMOUS_KEY);
    $itempolicygroupModel->createPolicy($anonymousGroup, $item, MIDAS_POLICY_READ);
    $this->params['itemId'] = $item->getKey();
    $this->dispatchUrI("/visualize/index/index");
    $this->assertController("index");

    $this->dispatchUrI("/visualize/image/index");
    $this->assertController("image");

    $this->dispatchUrI("/visualize/paraview/index");
    $this->assertController("paraview");

    $this->dispatchUrI("/visualize/media/index");
    $this->assertController("media");

    $this->dispatchUrI("/visualize/pdf/index");
    $this->assertController("pdf");

    $this->dispatchUrI("/visualize/txt/index");
    $this->assertController("txt");

    $this->dispatchUrI("/visualize/webgl/index");
    $this->assertController("webgl");
    }
  }<commit_msg>BUG: refs #439 Remove paraview test (for now)<commit_after><?php
/*=========================================================================
 MIDAS Server
 Copyright (c) Kitware SAS. 26 rue <NAME>. 69100 Villeurbanne, FRANCE
 All rights reserved.
 More information http://www.kitware.com

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

         http://www.apache.org/licenses/LICENSE-2.0.txt

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
=========================================================================*/


/** index controller test*/
class IndexControllerTest extends ControllerTestCase
  {
  /** set up tests*/
  public function setUp()
    {
    $this->setupDatabase(array('default'));
    $this->enabledModules = array('visualize');
    parent::setUp();
    }

  /** test index action*/
  public function testIndexAction()
    {
    $modelLoad = new MIDAS_ModelLoader();
    $itemModel = $modelLoad->loadModel('Item');
    $groupModel = $modelLoad->loadModel('Group');
    $itempolicygroupModel = $modelLoad->loadModel('Itempolicygroup');
    $userModel = $modelLoad->loadModel('User');

    $componentLoader = new MIDAS_ComponentLoader();
    $uploadComponent = $componentLoader->loadComponent('Upload');

    $usersFile = $this->loadData('User', 'default');
    $userDao = $userModel->load($usersFile[0]->getKey());

    Zend_Registry::set('notifier', new MIDAS_Notifier(false, null));
    Zend_Registry::set('configsModules', array());
    $item = $uploadComponent->createUploadedItem($userDao, "test.png", BASE_PATH.'/tests/testfiles/search.png', null, null, '', true);
    $anonymousGroup = $groupModel->load(MIDAS_GROUP_ANONYMOUS_KEY);
    $itempolicygroupModel->createPolicy($anonymousGroup, $item, MIDAS_POLICY_READ);
    $this->params['itemId'] = $item->getKey();
    $this->dispatchUrI("/visualize/index/index");
    $this->assertController("index");

    $this->dispatchUrI("/visualize/image/index");
    $this->assertController("image");

    $this->dispatchUrI("/visualize/media/index");
    $this->assertController("media");

    $this->dispatchUrI("/visualize/pdf/index");
    $this->assertController("pdf");

    $this->dispatchUrI("/visualize/txt/index");
    $this->assertController("txt");

    $this->dispatchUrI("/visualize/webgl/index");
    $this->assertController("webgl");
    }
  }
{'fraction_non_alphanumeric': 0.1951886276653909, 'fraction_numerical': 0.004920721705850191, 'mean_word_length': 4.825902335456475, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 61, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3106741', 'n_tokens_mistral': 1592, 'n_tokens_neox': 1500, 'n_words': 355}