public function setUp()
 {
     Kwf_Component_Data_Root::setComponentClass(false);
     if (!`which rrdtool`) {
         $this->markTestSkipped();
     }
 }
Beispiel #2
0
 public function setUp()
 {
     parent::setUp();
     Kwf_Model_Abstract::getInstance('Kwf_Form_MultiFields_TestModel1')->setData(array(array('id' => 1, 'blub' => 'blub0'), array('id' => 2, 'blub' => 'blub1'), array('id' => 3, 'blub' => 'blub2')));
     Kwf_Model_Abstract::getInstance('Kwf_Form_MultiFields_TestModel2')->setData(array(array('id' => 1, 'model1_id' => 1, 'foo' => 'foo0', 'bar' => 'bar0', 'pos' => 1), array('id' => 2, 'model1_id' => 1, 'foo' => 'foo1', 'bar' => 'bar1', 'pos' => 2), array('id' => 3, 'model1_id' => 2, 'foo' => 'foo2', 'bar' => 'bar2', 'pos' => 1), array('id' => 4, 'model1_id' => 3, 'foo' => 'foo0', 'pos' => 1), array('id' => 5, 'model1_id' => 3, 'foo' => 'foo1', 'pos' => 2), array('id' => 6, 'model1_id' => 3, 'foo' => 'foo2', 'pos' => 3)));
     Kwf_Component_Data_Root::setComponentClass(false);
     //damit ModelObserver nichts macht
 }
 private function _setup($rootClass)
 {
     Kwf_Component_Data_Root::setComponentClass($rootClass);
     $this->_root = Kwf_Component_Data_Root::getInstance();
     Kwf_Component_Cache::setInstance(Kwf_Component_Cache::CACHE_BACKEND_FNF);
     Kwf_Cache::factory('Core', 'Memcached', array('lifetime' => null, 'automatic_cleaning_factor' => false, 'automatic_serialization' => true))->clean();
     Kwf_Cache_Simple::resetZendCache();
 }
 public static function initForTests()
 {
     Kwf_Session::start();
     Kwf_Util_MemoryLimit::set(512);
     Kwf_Component_Data_Root::setComponentClass(false);
     Zend_Registry::set('db', Kwf_Test::getTestDb());
     set_time_limit(0);
     Kwf_Benchmark::disable();
 }
Beispiel #5
0
 public function setUp()
 {
     if (!Kwf_Registry::get('config')->amazon || !Kwf_Registry::get('config')->amazon->key) {
         $this->markTestSkipped();
     }
     Kwf_Component_Data_Root::setComponentClass('Kwc_Advanced_Amazon_Nodes_Root');
     $this->_root = Kwf_Component_Data_Root::getInstance();
     parent::setUp();
 }
 public function indexAction()
 {
     Zend_Registry::set('db', false);
     Kwf_Test_SeparateDb::setDbFromCookie();
     // setzt es nur wenn es das cookie wirklich gibt
     //FnF models setzen damit tests nicht in echte tabellen schreiben
     Kwf_Component_Cache::setInstance(Kwf_Component_Cache::CACHE_BACKEND_FNF);
     Kwf_Component_Cache_Memory::setInstance(new Kwf_Component_Cache_MemoryBlackHole());
     /*
     if (class_exists('APCIterator')) {
         $prefix = Kwf_Cache::getUniquePrefix();
         apc_delete_file(new APCIterator('user', '#^'.$prefix.'#'));
     } else {
         apc_clear_cache('user');
     }
     */
     Kwf_Component_Data_Root::setComponentClass($this->_getParam('root'));
     Zend_Registry::set('testRootComponentClass', $this->_getParam('root'));
     $root = Kwf_Component_Data_Root::getInstance();
     $root->setFilename('kwf/kwctest/' . $this->_getParam('root'));
     $url = $this->_getParam('url');
     $urlParts = explode('/', $url);
     if (is_array($urlParts) && $urlParts[0] == 'media') {
         if (sizeof($urlParts) != 7) {
             throw new Kwf_Exception_NotFound();
         }
         $class = $urlParts[1];
         $id = $urlParts[2];
         $type = $urlParts[3];
         $checksum = $urlParts[4];
         // time() wäre der 5er, wird aber nur wegen browsercache benötigt
         $filename = $urlParts[6];
         if ($checksum != Kwf_Media::getChecksum($class, $id, $type, $filename)) {
             throw new Kwf_Exception_AccessDenied('Access to file not allowed.');
         }
         Kwf_Media_Output::output(Kwf_Media::getOutput($class, $id, $type));
     }
     if ($url == 'kwf/util/kwc/render') {
         if (isset($_REQUEST['url'])) {
             $_REQUEST['url'] = str_replace('/' . $root->filename, '', $_REQUEST['url']);
         }
         Kwf_Util_Component::dispatchRender();
     }
     $domain = 'http://' . Zend_Registry::get('config')->server->domain;
     $data = $root->getPageByUrl($domain . Kwf_Setup::getBaseUrl() . '/' . $url, null);
     if (!$data) {
         throw new Kwf_Exception_NotFound();
     }
     $root->setCurrentPage($data);
     $contentSender = Kwc_Abstract::getSetting($data->componentClass, 'contentSender');
     $contentSender = new $contentSender($data);
     $contentSender->sendContent(true);
     Kwf_Benchmark::shutDown();
     Kwf_Benchmark::output();
     exit;
 }
Beispiel #7
0
 public static function fromUrlParameter($class, $parameter)
 {
     $param = explode(':', $parameter);
     $testDependenciesIni = $param[0];
     $rootComponentClass = $param[1];
     if ($rootComponentClass) {
         Kwf_Component_Data_Root::setComponentClass($rootComponentClass);
     }
     return new $class($testDependenciesIni, $param[2]);
 }
 public function setUp()
 {
     parent::setUp();
     //clear view cache
     Kwf_Cache::factory('Core', 'Memcached', array('lifetime' => null, 'automatic_cleaning_factor' => false, 'automatic_serialization' => true))->clean();
     Kwf_Cache_Simple::resetZendCache();
     Kwf_Component_Data_Root::setComponentClass('Kwc_FavouritesSelenium_Root');
     //use custom user model
     $this->presetModel = Kwf_Registry::get('config')->user->model;
     Kwf_Registry::get('config')->user->model = 'Kwc_FavouritesSelenium_UserModel';
     //unset existing userModel instance to get new one
     $reg = Kwf_Registry::getInstance()->set('userModel', Kwf_Model_Abstract::getInstance('Kwc_FavouritesSelenium_UserModel'));
 }
 public function setUp()
 {
     Kwf_Component_Data_Root::setComponentClass(false);
     Kwf_Component_Cache::setInstance(Kwf_Component_Cache::CACHE_BACKEND_FNF);
     Kwf_Events_ModelObserver::getInstance()->setSkipFnF(false);
     //clear cache as tests use new upload ids
     $dir = Kwf_Config::getValue('uploads') . "/mediaprescale";
     if (file_exists($dir)) {
         foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir, FilesystemIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST) as $path) {
             $path->isFile() ? unlink($path->getPathname()) : rmdir($path->getPathname());
         }
     }
 }
Beispiel #10
0
 protected function _init($componentClass)
 {
     Kwf_Component_Data_Root::setComponentClass($componentClass);
     Zend_Session::$_unitTestEnabled = true;
     $this->_root = Kwf_Component_Data_Root::getInstance();
     $this->_root->setFilename('kwf/kwctest/' . $componentClass);
     if (function_exists('apc_clear_cache')) {
         apc_clear_cache('user');
     }
     Kwf_Component_Cache_Memory::getInstance()->_clean();
     Kwf_Cache_Simple::resetZendCache();
     Kwc_FulltextSearch_MetaModel::setInstance(new Kwf_Model_FnF(array('primaryKey' => 'page_id')));
     Kwf_Assets_Package_Default::clearInstances();
     Kwf_Component_LogDuplicateModel::setInstance(new Kwf_Model_FnF(array()));
     Kwf_Media_MemoryCache::getInstance()->clean();
     return $this->_root;
 }
 public function getControllerClass(Zend_Controller_Request_Abstract $request)
 {
     $module = $request->getModuleName();
     if ($module == 'component' && $request->getControllerName() == 'component' || $module == 'component_test' && $request->getControllerName() == 'component_test') {
         if ($module == 'component_test') {
             //FnF models setzen damit tests nicht in echte tabellen schreiben
             Kwf_Component_Cache::setInstance(Kwf_Component_Cache::CACHE_BACKEND_FNF);
             Kwf_Test_SeparateDb::setDbFromCookie();
             // setzt es nur wenn es das cookie wirklich gibt
             if (!Kwf_Loader::isValidClass($request->getParam('root'))) {
                 throw new Kwf_Exception_NotFound("Invalid root component");
             }
             Kwf_Component_Data_Root::setComponentClass($request->getParam('root'));
             $root = Kwf_Component_Data_Root::getInstance();
             $root->setFilename('kwf/kwctest/' . $request->getParam('root'));
             Kwf_Registry::get('acl')->getComponentAcl()->allowComponent('guest', null);
             //hick hack, für Kwf_Component_Abstract_Admin::getControllerUrl
             Zend_Registry::set('testRootComponentClass', $request->getParam('root'));
         }
         $class = $request->getParam('class');
         $controller = $request->getParam('componentController');
         $controller .= 'Controller';
         if ($controller == 'IndexController') {
             $controller = 'Controller';
         }
         if (($pos = strpos($class, '!')) !== false) {
             $controller = substr($class, $pos + 1) . 'Controller';
             $class = substr($class, 0, $pos);
         }
         if (!in_array($class, Kwc_Abstract::getComponentClasses())) {
             //unknown component class
             return false;
         }
         $className = Kwc_Admin::getComponentClass($class, $controller);
         if (!$className) {
             return false;
         }
         class_exists($className);
         //trigger autoloader
     } else {
         $className = parent::getControllerClass($request);
     }
     return $className;
 }
Beispiel #12
0
 public function testCached()
 {
     Kwf_Benchmark::enable();
     Kwf_Benchmark::reset();
     $d = Kwf_Registry::get('testDomain');
     $c = $this->_root->getPageByUrl("http://{$d}/foo", null);
     //uncached
     $this->assertEquals('1', $c->componentId);
     $this->assertEquals(1, Kwf_Benchmark::getCounterValue('componentDatas'));
     $this->assertEquals(0, (int) Kwf_Benchmark::getCounterValue('unserialized componentDatas'));
     Kwf_Component_Data_Root::reset();
     Kwf_Component_Data_Root::setComponentClass('Kwf_Component_Cache_UrlClearCache_Root');
     $this->_root = Kwf_Component_Data_Root::getInstance();
     Kwf_Benchmark::reset();
     $c = $this->_root->getPageByUrl("http://{$d}/foo", null);
     //cached
     $this->assertEquals('1', $c->componentId);
     $this->assertEquals(0, (int) Kwf_Benchmark::getCounterValue('componentDatas'));
     $this->assertEquals(1, Kwf_Benchmark::getCounterValue('unserialized componentDatas'));
 }
 public function setUp()
 {
     Kwf_Component_Data_Root::setComponentClass('Kwc_Basic_TextSessionModel_Root');
     parent::setUp();
 }
 public function setUp()
 {
     Kwf_Component_Data_Root::setComponentClass('Kwf_Component_SharedData_Component');
     parent::setUp();
 }
 public function setUp()
 {
     parent::setUp();
     Kwf_Component_Data_Root::setComponentClass('Kwc_Legacy_Columns_Basic_Root');
 }
 public function setUp()
 {
     parent::setUp();
     Kwf_Component_Data_Root::setComponentClass('Kwc_Composite_ImagesEnlarge_Root');
 }
 public function setUp()
 {
     Kwf_Component_Data_Root::setComponentClass(false);
 }
Beispiel #18
0
 public function setUp()
 {
     parent::setUp();
     Kwf_Component_Data_Root::setComponentClass('Kwc_FormDynamic_Basic_Root');
 }
 public function setUp()
 {
     Kwf_Component_Data_Root::setComponentClass('Kwc_Advanced_SocialBookmarks_Root');
     parent::setUp();
 }
 public function setUp()
 {
     parent::setUp();
     Kwf_Component_Data_Root::setComponentClass('Kwc_Directories_AjaxViewTwoOnOnePage_Root');
 }
 public function setUp()
 {
     parent::setUp();
     Kwf_Component_Data_Root::setComponentClass('Kwc_TextImage_Root');
 }
Beispiel #22
0
 public function setUp()
 {
     Kwf_Component_Data_Root::setComponentClass('Kwf_Form_FieldSet_Frontend_Root');
     $this->_root = Kwf_Component_Data_Root::getInstance();
     parent::setUp();
 }
Beispiel #23
0
 public function setUp()
 {
     parent::setUp();
     Kwf_Component_Data_Root::setComponentClass('Kwc_Directories_AjaxViewMultipleDirectories_Root');
 }
 public function setUp()
 {
     parent::setUp();
     Kwf_Component_Data_Root::setComponentClass('Kwc_Paragraphs_Paragraphs');
 }
Beispiel #25
0
 public function tearDown()
 {
     parent::tearDown();
     Kwf_Component_Data_Root::setComponentClass(null);
 }
 public function setUp()
 {
     parent::setUp();
     Kwf_Component_Data_Root::setComponentClass('Kwc_Trl_Table_Root_Root');
 }
 public function preDispatch()
 {
     //RowObserver brauchen wir hier nicht
     Kwf_Component_Data_Root::setComponentClass(false);
     parent::preDispatch();
 }
Beispiel #28
0
 /**
  *   http://kwf.niko.vivid/kwf/kwctest/Kwc_ImageResponsive_InScrollDiv_Root_Component/image1
  */
 public function setUp()
 {
     parent::setUp();
     Kwf_Component_Data_Root::setComponentClass('Kwc_ImageResponsive_InScrollDiv_Root_Component');
 }
 public function setUp()
 {
     parent::setUp();
     Kwf_Component_Data_Root::setComponentClass('Kwc_FormWizard_Root');
 }
Beispiel #30
0
 /**
  * Use this links to test components for responsiveness:
  * This is a manually test. Please copy urls into browser and check result
  * and especially behaviour for different screensizes
  *
  * Abstract-Image-Component:
  *   http://kwf.benjamin.vivid/kwf/kwctest/Kwc_ImageResponsive_CreatesImgElement_Root_Component/imageabstract1
  *   http://kwf.benjamin.vivid/kwf/kwctest/Kwc_ImageResponsive_CreatesImgElement_Root_Component/imageabstract2
  *   http://kwf.benjamin.vivid/kwf/kwctest/Kwc_ImageResponsive_CreatesImgElement_Root_Component/imageabstract3
  *   http://kwf.benjamin.vivid/kwf/kwctest/Kwc_ImageResponsive_CreatesImgElement_Root_Component/imageabstract4
  *
  * Basic-Image-Component:
  *   http://kwf.benjamin.vivid/kwf/kwctest/Kwc_ImageResponsive_CreatesImgElement_Root_Component/imagebasic1
  *
  * Basic-Image-Enlarge-Component:
  *   http://kwf.benjamin.vivid/kwf/kwctest/Kwc_ImageResponsive_CreatesImgElement_Root_Component/imageenlarge1
  *
  * TextImage-Component:
  *   http://kwf.benjamin.vivid/kwf/kwctest/Kwc_ImageResponsive_CreatesImgElement_Root_Component/textimage1
  */
 public function setUp()
 {
     parent::setUp();
     Kwf_Component_Data_Root::setComponentClass('Kwc_ImageResponsive_CreatesImgElement_Root_Component');
 }