public static function setUpBeforeClass() { $configuration = new Configuration(); self::$selenium_test_page_path = $configuration->getSeleniumTestPagePath(); self::$selenium_execution_context = new SeleniumExecutionContext("firefox", "file://" . self::$selenium_test_page_path, "jQuery"); self::$selenium_driven_user = new SeleniumDrivenUser(self::$selenium_execution_context); }
/** * Constructor * * Inits the appropriate endpoint and httpconnector objects * Sets all of the Profiles class properties * * @param \Beanstream\Configuration $config */ function __construct(Configuration $config) { //init endpoint $this->_endpoint = new Endpoints($config->getPlatform(), $config->getApiVersion()); //init http connector $this->_connector = new HttpConnector(base64_encode($config->getMerchantId() . ':' . $config->getApiKey())); }
public function createRequest() { $uri = $_SERVER['REQUEST_URI']; $basePath = $this->configuration->getBasePath(); if ($basePath && strncmp($uri, $basePath, strlen($basePath)) !== 0) { throw new ApiException("Invalid endpoint"); } $uri = substr($uri, strlen($basePath) - 1); if ($this->configuration->getPublicKey() !== trim($_SERVER['HTTP_X_API_KEY'])) { throw new AuthorizationException("Invalid API key"); } $hasBody = $this->hasBody(); $input = $hasBody ? file_get_contents('php://input') : ''; $signature = hash_hmac('sha256', $uri . $input, $this->configuration->getPrivateKey()); if ($signature !== trim($_SERVER['HTTP_X_API_SIGNATURE'])) { throw new AuthorizationException("Invalid signature"); } if ($hasBody) { $parameters = json_decode($input, JSON_OBJECT_AS_ARRAY); if ($parameters === NULL && $input !== '' && strcasecmp(trim($input, " \t\n\r"), 'null') !== 0) { $error = json_last_error(); throw new ApiException('JSON parsing error: ' . $error); } } else { $parameters = filter_input_array(INPUT_GET, FILTER_UNSAFE_RAW); } $name = ($a = strpos($uri, '?')) !== FALSE ? substr($uri, 0, $a) : $uri; return new Request(ltrim($name, '/'), $_SERVER['REQUEST_METHOD'], $parameters); }
public function run() { $config = new Configuration(); $config->name = 'beer_of_the_day_modification_date'; $config->value = Carbon::now()->format('Y-m-d'); $config->save(); }
protected function assertConfiguration(Configuration $config, $srcDir, array $cloverXml, $jsonPath, $excludeNoStatements = false) { $this->assertEquals($srcDir, $config->getSrcDir()); $this->assertEquals($cloverXml, $config->getCloverXmlPaths()); $this->assertEquals($jsonPath, $config->getJsonPath()); $this->assertEquals($excludeNoStatements, $config->isExcludeNoStatements()); }
/** * * @return AddOn[] */ public function all() { $path = $this->_config->merchantPath() . '/add_ons'; $response = $this->_http->get($path); $addOns = ["addOn" => $response['addOns']]; return Util::extractAttributeAsArray($addOns, 'addOn'); }
public static function reminderInvoker(Folder $folder) { $configuration = new Configuration(); //parameter to know the max gap between last parsing done on the folder. $invokeMinutes = $configuration->getConfiguration(ConfigurationKeys::$reminderInvokeMinutes); //parameter to know the max gap between notifications $intervalMinutes = $configuration->getConfiguration(ConfigurationKeys::$reminderIntervalMinutes); $invokeMinutes = intval($invokeMinutes); $intervalMinutes = intval($intervalMinutes); $parsedSinceMinutes = self::getDatesDifferenceInMinutes($folder->getLastParsedOn(), date("Y-m-d H:i:s")); if ($parsedSinceMinutes > 0) { //OK we have some minutes passed with no parsing undertook if ($parsedSinceMinutes > $invokeMinutes) { //if reminder already sent, check interval and send again if ($folder->getLastRemindedOn() != null) { $lastRemindedSince = self::getDatesDifferenceInMinutes($folder->getLastRemindedOn(), date("Y-m-d H:i:s")); if ($lastRemindedSince > $intervalMinutes) { self::sendNotification($folder); FolderDataStore::getInstance()->updateLastReminderDate($folder->getSeq()); } } else { self::sendNotification($folder); FolderDataStore::getInstance()->updateLastReminderDate($folder->getSeq()); } } else { //time still there to remind } } }
public function __construct() { parent::__construct(); $this->opo_app_config = Configuration::load(); $vs_external_app_config_path = $this->opo_app_config->get('external_applications'); $this->opo_external_app_config = Configuration::load($vs_external_app_config_path); }
public function testSetOptionsWithValidOptions() { $key = 'steam-api-key'; $options = array(Configuration::STEAM_KEY => $key); $this->configuration->setOptions($options); $this->assertEquals($key, $this->configuration->getSteamKey()); }
public function loadClass($class) { // Enable PSR-4 style namespace support. $class = str_replace('\\', DIRECTORY_SEPARATOR, $class); if (substr($class, -10) == 'Controller') { // This is a controller class file. $filename = "{$this->controllerPath}/{$class}.class.php"; } else { if (substr($class, -4) == 'Form') { // This is a form class file. $filename = "{$this->applicationPath}/forms/{$class}.class.php"; } elseif (substr($class, -5) == 'Model') { // This is a model class file. $filename = "{$this->applicationPath}/models/{$class}.class.php"; } else { // This is an application class file (outside of MVC). $filename = "{$this->applicationPath}/classes/{$class}.class.php"; } } if (file_exists($filename) == true) { /** @noinspection PhpIncludeInspection */ include $filename; } else { if ($this->configuration->get('library', 'autoload-chain', false) == false) { throw new ErrorException("La classe <strong>{$class}</strong> ne se trouve pas " . "dans le fichier<br><strong>{$filename}</strong>"); } } }
/** * connection using the injected config */ public function connect() { $host = $this->configuration->get('host'); // connection to host, authentication etc... //if connected $this->host = $host; }
public function testGetInstanceWithWrongConfiguredParameterThrowsException() { $this->setExpectedException('rg\\injektor\\InjectionException', 'Invalid argument without class typehint class: [rg\\injektor\\DICTestClassNoTypeHint] method: [__construct] argument: [two]'); $config = new Configuration(null, ''); $config->setClassConfig('rg\\injektor\\DICTestClassNoTypeHint', array('params' => array('one' => array('value' => 'foo')))); $dic = $this->getContainer($config); $dic->getInstanceOfClass('rg\\injektor\\DICTestClassNoTypeHint'); }
public function __construct(Configuration $configuration, DatabaseVersion $dbVersion, DeltaDirectory $deltaDirectory) { $this->dbName = $configuration->dbName(); $this->dbUsername = $configuration->dbUsername(); $this->dbPassword = $configuration->dbPassword(); $this->dbVersion = $dbVersion; $this->deltaDirectory = $deltaDirectory; }
public function build(Configuration $config) { $serviceConfig = $config->get(Configuration::SERVICE); $serviceClass = $this->getServiceClass($serviceConfig); $serverUrl = $this->extractParameter(AbstractServiceManager::SERVER_URL, $serviceConfig); $watchedServices = $this->getWatchedServices($serviceConfig); return new $serviceClass($serverUrl, $config->getConfigDir(), $watchedServices); }
/** * @covers Airbrake\Configuration::verify */ public function testVerify() { $this->object->set('apiKey', null); try { $this->object->verify(); } catch (\Exception $e) { $this->assertInstanceOf('Airbrake\\Exception', $e); } }
public function add($key, $value, $ns = 'conf') { $config = new Configuration(); $config->setKey($ns . ':' . $key); $config->setValue($value); $config->save(); $this->confTab[$ns][$key] = $value; unset($_SESSION['configuration']); }
public function testNonDefaultValuesDefine() { $name = uniqid('name'); $realValue = uniqid('realValue'); $default = uniqid('value'); $config = new Configuration([$name => $realValue]); $config->define($name, $default); $expected = $realValue; $this->assertEquals(constant($name), $expected, 'The parameter is not defined properly with real value'); }
/** * Test get pass phrase with use PasswordGetter system */ public function testGetPassPhraseWithUsePasswordGetter() { $configuration = new Configuration('name', 'localhost', 80); $configuration->setUser('user'); $passwordGetter = $this->getMockForAbstractClass('Deployer\\Server\\Password\\PasswordGetterInterface'); $passwordGetter->expects($this->once())->method('getPassword')->with('localhost', 'user')->will($this->returnValue('some-pass-phrase')); $configuration->setPassPhrase($passwordGetter); $passPhrase = $configuration->getPassPhrase(); $this->assertEquals('some-pass-phrase', $passPhrase, 'Pass phrases mismatch'); }
/** * Returns a writable directory for temporary files * * @return String * @see Configuration::setTempDirectory() * @throws NoTempDirectoryException */ public function getTempDirectory() { if (!is_null($this->configuration->getTempDirectory())) { return $this->configuration->getTempDirectory(); } if (is_null($this->cachedTempDirectory)) { $this->cachedTempDirectory = $this->findTempDirectory(); } return $this->cachedTempDirectory; }
public function testGlobbingSupport() { $basePath = getcwd() . DS; $configuration = new Configuration($this->fixture('phpunit-globbing.xml')); /** @var SuitePath[][] $suites */ $suites = $configuration->getSuites(); $this->assertEquals($basePath . 'test' . DS . 'fixtures' . DS . 'globbing-support-tests' . DS . 'some-dir', $suites["ParaTest Fixtures"][0]->getPath()); $this->assertEquals($basePath . 'test' . DS . 'fixtures' . DS . 'globbing-support-tests' . DS . 'some-dir2', $suites["ParaTest Fixtures"][1]->getPath()); return $suites; }
/** * @static * @param $name * @param $value * @return void */ public static function set($name, $value = null) { $configuration = ConfigurationPeer::retrieveByName($name); if (!$configuration) { $configuration = new Configuration(); $configuration->setName($name); } $configuration->setValue($value); $configuration->save(); }
function getConnectionSettings() { require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/conf/configuration.class.php'; $configuration = new Configuration(); extract($configuration->getDatabaseConnectionSettings()); $this->host = $host; $this->database = $database; $this->username = $username; $this->password = $password; }
/** * DataManager constructor. * @param Configuration $conf */ function __construct(Configuration $conf) { $this->message = ""; try { $data = new \PDO('mysql:host=' . $conf->getDbHost() . ';dbname=' . $conf->getDbName() . '', $conf->getDbUser(), $conf->getDbPass()); $this->data_manager = new \FluentPDO($data); $this->data_manager->debug = false; } catch (\Exception $ex) { $this->message = "Database connection failed : " . $ex->getMessage(); } }
protected function localRelease() { $configuration = new Configuration('wakka.config.php'); $configuration->load(); $release = Release::UNKNOW_RELEASE; if (isset($configuration['yeswiki_release'])) { $release = $configuration['yeswiki_release']; } $release = new Release($release); return $release; }
/** * TestCase Constructor. * * @return void */ public function setUp() { $this->sub_configuration = $this->getMock('Lunr\\Core\\Configuration'); $this->configuration = $this->getMock('Lunr\\Core\\Configuration'); $map = array(array('path', $this->sub_configuration)); $this->configuration->expects($this->any())->method('offsetGet')->will($this->returnValueMap($map)); $this->request = $this->getMock('Lunr\\Corona\\RequestInterface'); $this->response = $this->getMock('Lunr\\Corona\\Response'); $this->class = $this->getMockBuilder('Lunr\\Corona\\View')->setConstructorArgs(array($this->request, $this->response, $this->configuration))->getMockForAbstractClass(); $this->reflection = new ReflectionClass('Lunr\\Corona\\View'); }
function zcssleedmaker_plugin_update($_) { if ($_['action'] == 'zcssleedmaker_update') { $configurationManager = new Configuration(); $configurationManager->getAll(); $configurationManager->put('plugin_cssLeedMaker_css', $_['plugin_cssLeedMaker_css']); $configurationManager->put('plugin_cssLeedMaker_addcss', rawurlencode($_['plugin_cssLeedMaker_addcss'])); $_SESSION['configuration'] = null; header('location: settings.php#CSSLeedMaker'); } }
/** * Initializes the shared configuration * * @param string $basePath * @return Configuration */ public static function initializeConfiguration($basePath) { // Read the configurations file $configuration = array(); $configurationFile = $basePath . 'Configurations/Configuration.json'; if (file_exists($configurationFile) && is_readable($configurationFile)) { $configuration = json_decode(file_get_contents($configurationFile), TRUE); } self::$sharedConfiguration = new Configuration($configuration); self::$sharedConfiguration->set('basePath', $basePath); return self::$sharedConfiguration; }
/** * Mapping constructor. */ public function __construct() { // set up basic properties $this->opo_datamodel = \Datamodel::load(); $this->opo_search_conf = \Configuration::load(\Configuration::load()->get('search_config')); $this->opo_indexing_conf = \Configuration::load($this->opo_search_conf->get('search_indexing_config')); $this->opo_db = new \Db(); $this->opo_search_base = new \SearchBase($this->opo_db, null, false); $this->opa_element_info = array(); $this->opo_app_vars = new \ApplicationVars($this->opo_db); $this->prefetchElementInfo(); }
function TemplatePath($name) { require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/conf/configuration.class.php'; $Configuration = new Configuration(); $prepend = $Configuration->TemplateDirectory(); $file = $prepend . '/' . $name . '.template.php'; if (is_file($file)) { return $file; } else { return false; } }
function intheleed_plugin_update($_) { $myUser = isset($_SESSION['currentUser']) ? unserialize($_SESSION['currentUser']) : false; if ($myUser === false) { exit(_t('P_INTHELEED_CONNECTION_ERROR')); } if ($_['action'] == 'intheleed_update') { $configurationManager = new Configuration(); $configurationManager->put('plugin_poche_link', $_['plugin_poche_link']); $_SESSION['configuration'] = null; header('location: settings.php'); } }