function test_get_datasource() { $this->ds = new MockDataSource(); $proxy = new ProxyDataSource($this->ds); $this->ds->foo = 'bar'; // Reference semantics $this->assertIdentical($proxy->get_datasource(), $this->ds); }
function Module($name = NULL, $datasource_class = NULL) { global $CONF; if ($name != '') { $this->name = $name; } if ($datasource_class != '') { $this->datasource_class = $datasource_class; } $this->path = $CONF['path_modules'] . $this->name . '/'; // Get module right from HTTP query string for debugging if (@$CONF['debug'] && isset($_GET['module_right'])) { $this->user_right = $_GET['module_right']; } // Keep saved search/auto-alert flags in sync //### TODO: Find a better way to do this if ($this->auto_alert_enabled) { $this->saved_search_enabled = TRUE; } // If the user needs a right to see the module, show the login form if ($this->user_right != '') { $this->show_login_form = TRUE; } // add block 'all fields' search filter if (!$this->all_fields_search_enabled) { $filter = array('BlockAllFieldsSearchFilter'); if (isset($this->query_config['filters']) && is_array($this->query_config['filters'])) { $this->query_config['filters'] = array_merge($this->query_config['filters'], $filter); } else { $this->query_config['filters'] = $filter; } } // Don't show module name in URL if there is only one module if (!$CONF['unit_test_active']) { $this->add_module_to_url = @$CONF['multi_module']; } // Create DS parent::__construct(new ModuleResolver()); //### }