public function setUp() { $testUtils = new TestUtils(Environment::SANDBOX); $this->terminationInquiryService = new TerminationInquiryService(TestUtils::SANDBOX_CONSUMER_KEY, $testUtils->getPrivateKey(), Environment::SANDBOX); $this->terminationInquiryHistoryService = new TerminationInquiryHistoryService(TestUtils::SANDBOX_CONSUMER_KEY, $testUtils->getPrivateKey(), Environment::SANDBOX); $this->terminationInquiryRequest = new TerminationInquiryRequestType(); $this->terminationInquiryRequest->setMerchantType(new MerchantType()); $this->terminationInquiryRequest->getMerchantType()->setAddress(new AddressType()); $this->terminationInquiryRequest->getMerchantType()->setPrincipal(new PrincipalType()); $this->terminationInquiryRequest->getMerchantType()->getPrincipal()->setAddress(new AddressType()); $this->terminationInquiryRequest->getMerchantType()->getPrincipal()->setDriversLicense(new DriversLicenseType()); $this->terminationInquiryRequest->setAcquirerId("1996"); $this->terminationInquiryRequest->setTransactionReferenceNumber("12345"); $this->terminationInquiryRequest->getMerchantType()->setName("TERMINATED MERCHANT 2"); $this->terminationInquiryRequest->getMerchantType()->setDoingBusinessAsName("DOING BUSINESS AS TERMINATED MERCHANT 2"); $this->terminationInquiryRequest->getMerchantType()->setPhoneNumber("5555555555"); $this->terminationInquiryRequest->getMerchantType()->getAddress()->setLine1("20 EAST MAIN ST"); $this->terminationInquiryRequest->getMerchantType()->getAddress()->setLine2("EAST ISLIP NY"); $this->terminationInquiryRequest->getMerchantType()->getAddress()->setCity("EAST ISLIP"); $this->terminationInquiryRequest->getMerchantType()->getAddress()->setCountrySubdivision("NY"); $this->terminationInquiryRequest->getMerchantType()->getAddress()->setPostalCode("55555"); $this->terminationInquiryRequest->getMerchantType()->getAddress()->setCountry("USA"); $this->terminationInquiryRequest->getMerchantType()->setCountrySubdivisionTaxId("205545287"); $this->terminationInquiryRequest->getMerchantType()->setNationalTaxId("2891327625"); $this->terminationInquiryRequest->getMerchantType()->getPrincipal()->setFirstName("PATRICIA"); $this->terminationInquiryRequest->getMerchantType()->getPrincipal()->setLastName("CLARKE"); $this->terminationInquiryRequest->getMerchantType()->getPrincipal()->setNationalId("4236559970"); $this->terminationInquiryRequest->getMerchantType()->getPrincipal()->getAddress()->setLine1("93-52 243 STREET"); $this->terminationInquiryRequest->getMerchantType()->getPrincipal()->getAddress()->setCity("BELLEROSE"); $this->terminationInquiryRequest->getMerchantType()->getPrincipal()->getAddress()->setCountrySubdivision("NY"); $this->terminationInquiryRequest->getMerchantType()->getPrincipal()->getAddress()->setPostalCode("55555-5555"); $this->terminationInquiryRequest->getMerchantType()->getPrincipal()->getAddress()->setCountry("USA"); }
public function setUp() { $testUtils = new TestUtils(Environment::SANDBOX); $this->repowerService = new RepowerService(TestUtils::SANDBOX_CONSUMER_KEY, $testUtils->getPrivateKey(), Environment::SANDBOX); $this->repowerReversalService = new RepowerReversalService(TestUtils::SANDBOX_CONSUMER_KEY, $testUtils->getPrivateKey(), Environment::SANDBOX); $this->repowerRequest = new RepowerRequest(); $this->repowerReversalRequest = new RepowerReversalRequest(); $this->repowerRequest->setTransactionAmount(new TransactionAmount()); $this->repowerRequest->setCardAcceptor(new CardAcceptor()); }
public function testCountRidesForContactId() { TestUtils::clearDatabase(); $testContact = $this->dbh->addContact('test1', '1234', '*****@*****.**', ROLE_IDENTIFIED_REGISTERED); if (!$testContact) { $this->fail('addContact failed'); } $count = $this->dbh->countRidesForContactId($testContact); $this->assertEquals(0, $count); $testRide1 = $this->dbh->addRide(1, 'city_1', 2, 'city_2', TIME_IRRELEVANT, TIME_IRRELEVANT, $testContact, '', RIDE_ACTIVE, 0, 1); if (!$testRide1) { $this->fail('addRide failed'); } $count = $this->dbh->countRidesForContactId($testContact); $this->assertEquals(1, $count); $testRide2 = $this->dbh->addRide(1, 'city_1', 2, 'city_2', TIME_IRRELEVANT, TIME_IRRELEVANT, $testContact, '', RIDE_INACTIVE, 0, 1); if (!$testRide2) { $this->fail('addRide failed'); } // Inactive rides also count $count = $this->dbh->countRidesForContactId($testContact); $this->assertEquals(2, $count); // Now, make sure we get 0 for non-existent contact $count = $this->dbh->countRidesForContactId($testContact + 1); $this->assertEquals(0, $count); }
public function setUp() { $testUtils = new TestUtils(Environment::SANDBOX); $this->fraudScoringService = new FraudScoringService(TestUtils::SANDBOX_CONSUMER_KEY, $testUtils->getPrivateKey(), Environment::SANDBOX); $this->scoreLookupRequest = new ScoreLookupRequest(); $this->scoreLookupRequest->setTransactionDetail(new TransactionDetail()); $this->scoreLookupRequest->getTransactionDetail()->setCustomerIdentifier(1996); $this->scoreLookupRequest->getTransactionDetail()->setMerchantIdentifier(123); $this->scoreLookupRequest->getTransactionDetail()->setAccountNumber("5555555555555555555"); $this->scoreLookupRequest->getTransactionDetail()->setAccountPrefix(555555); $this->scoreLookupRequest->getTransactionDetail()->setAccountSuffix(5555); $this->scoreLookupRequest->getTransactionDetail()->setTransactionDate(1231); $this->scoreLookupRequest->getTransactionDetail()->setTransactionTime("035959"); $this->scoreLookupRequest->getTransactionDetail()->setBankNetReferenceNumber("abcABC123"); $this->scoreLookupRequest->getTransactionDetail()->setStan(123456); }
public static function setUpBeforeClass() { parent::setUpBeforeClass(); // copy CSS test file to test directory TestUtils::rcopy(DOKU_INC . '_test/data/tmp', DOKU_INC . 'lib/plugins/odt/_test/dw_css_with_wrap.css'); TestUtils::rcopy(DOKU_INC . '_test/data/tmp', DOKU_INC . 'lib/plugins/odt/_test/dw_css_without_extra_wrap.css'); }
function test1() { $ch = curl_init("http://example.com?foo=bar"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); TestUtils::assertTrue(isset($response)); }
/** * Setup the testing environment * * @author Johnathan Pulos <*****@*****.**> */ public function setUp() { parent::setUp(); $this->plugin = new action_plugin_revhistory(); $this->plugin->testing = true; $this->eventHandler = $this->getMockBuilder('Doku_Event')->setConstructorArgs(array('ACTION_ACT_PREPROCESS', 'revhistory'))->getMock(); TestUtils::rcopy(TMP_DIR, dirname(__FILE__) . '/data/'); }
public static function setupPlugins($plugins = []) { $plugins = array_merge(self::defaultPlugins, $plugins); foreach (new \DirectoryIterator(DOKU_INC . 'lib/plugins/') as $fi) { if ($fi->isDir() && !$fi->isDot() && !in_array($fi->getFilename(), $plugins)) { // enable these $entry = $fi->getFilename(); \TestUtils::fappend(vfsStream::url('root/conf/plugins.local.php'), "\$plugins['{$entry}'] = 0;\n"); } } }
function testSuccessLogonNewUser() { TestUtils::clearDatabase(); $id = DatabaseHelper::getInstance()->addContact('user2', '', '*****@*****.**', ROLE_IDENTIFIED, Utils::hashPassword('---longpassword123---')); // First let's fail $params1 = array('email' => '*****@*****.**', 'password' => '---longpassword12---'); $this->assertFalse($this->helper->authenticate($params1)); // This should work $params2 = array('email' => '*****@*****.**', 'password' => '---longpassword123---'); $contact = $this->helper->authenticate($params2); $this->assertTrue($contact !== false); $this->assertEquals($id, $contact['Id']); $this->assertEquals(ROLE_IDENTIFIED, $contact['Role']); }
function testSuccessLogonExistingUser() { TestUtils::clearDatabase(); $params = array('user' => 'User2', 'password' => 'User2'); $this->assertEquals(0, $this->contactsCount()); $contact = $this->helper->authenticate($params); $this->assertTrue($contact !== false); // A new user should be created $this->assertTrue($this->contactExists($contact['Id'])); $this->assertEquals(1, $this->contactsCount()); // Now, let's authenticate the same user $contact2 = $this->helper->authenticate($params); $this->assertTrue($contact['Id'] === $contact2['Id']); }
/** * Setup the data directory * * This is ran before each test class */ public static function setUpBeforeClass() { // just to be safe not to delete something undefined later if (!defined('TMP_DIR')) { die('no temporary directory'); } if (!defined('DOKU_TMP_DATA')) { die('no temporary data directory'); } // remove any leftovers from the last run if (is_dir(DOKU_TMP_DATA)) { TestUtils::rdelete(DOKU_TMP_DATA); } // populate default dirs TestUtils::rcopy(TMP_DIR, dirname(__FILE__) . '/../data/'); }
/** * helper for recursive rmdir()/unlink() * * @static * @param $target string */ public static function rdelete($target) { if (!is_dir($target)) { unlink($target); } else { $dh = dir($target); while (false !== ($entry = $dh->read())) { if ($entry == '.' || $entry == '..') { continue; } TestUtils::rdelete("{$target}/{$entry}"); } $dh->close(); rmdir($target); } }
/** * Loads google page and searches for some keyword */ public function testFetchGoogleResults() { if ($this->assertTrue($this->connect(), 'Failed connecting to Selenium web driver.')) { $url = 'http://www.google.com/'; $this->driver->get($url); $title = $this->driver->getTitle(); if ($this->assertTrue(false !== stripos($title, 'Google'), 'Failed loading page from [' . $url . ']')) { $element = $this->driver->findElementBy(LocatorStrategy::name, "q"); $element->sendKeys("php webdriver bindings"); $element->submit(); $image = $this->driver->getScreenshot(); $image = base64_decode($image); TestUtils::snapshot($image, 'google-screenshot-1', false, 'google-screenshot-1.png'); } // you may want to place it under tearDown() $this->driver->closeWindow(); } }
public function testRoleInAcl() { $groupXml = '<?xml version="1.0" encoding="UTF-8"?> <GroupList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="GroupList-1.0.0.xsd"> <Group> <Name>Everyone</Name> <Description>Built-in group to include all users</Description> </Group> </GroupList>'; $br = TestUtils::mockByteReader($this, $groupXml); $this->assertEquals("text/xml", $br->GetMimeType()); $this->assertEquals($groupXml, $br->ToString()); $site = $this->getMockBuilder("MgSite")->getMock(); $site->method("EnumerateGroups")->will($this->returnValue($br)); $roleMethodMap = array(array("Author", new FakeStringCollection(array("Authors"))), array("Anonymous", new FakeStringCollection(array("Users")))); $site->method("EnumerateRoles")->will($this->returnValueMap($roleMethodMap)); $conf1 = array("AllowUsers" => array("Administrator"), "AllowGroups" => array("Foo"), "AllowRoles" => array("Users")); $this->assertFalse(MgUtils::ValidateAcl("Author", $site, $conf1)); $conf2 = array("AllowUsers" => array("Administrator"), "AllowGroups" => array("Foo"), "AllowRoles" => array("Users")); $this->assertTrue(MgUtils::ValidateAcl("Anonymous", $site, $conf2)); }
/** * Fetch page from google and search for some keyword. */ public function testFetchGoogleResults() { $browser = new SimpleBrowser(); // inject debugging cookie, if we want to debug request - makes sense only if we do request to the same server with DBG module if (!empty($_COOKIE['DBGSESSID'])) { $browser->setCookie('DBGSESSID', $_COOKIE['DBGSESSID']); } $url = 'http://www.google.com/'; $html = $browser->get($url); // store fetched page into temporary file and display quick download link TestUtils::snapshot($html, 'google-main-page'); if ($this->assertTrue(false !== stripos($browser->getTitle(), 'google'), 'Failed loading page from ' . $url . '!')) { $keyword = 'simpletest'; // load search results for "simpletest" $browser->setField('q', $keyword); $html = $browser->clickSubmitByName('btnG'); if ($this->assertTrue(false !== strpos($browser->getTitle(), $keyword), 'Failed loading search results for ' . $keyword . '!')) { TestUtils::snapshot($html, 'google-search-results'); } } }
/** * Extract a tarbomomb */ public function test_tarbomb() { $dir = dirname(__FILE__) . '/tar'; $out = sys_get_temp_dir() . '/dwtartest' . md5(time()); $tar = new Tar(); $tar->open("{$dir}/tarbomb.tgz"); $tar->extract($out); clearstatcache(); $this->assertFileExists($out . '/AAAAAAAAAAAAAAAAA/BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB.txt'); TestUtils::rdelete($out); }
}); } else { echo ">>>> Preserving temporary directory: " . TMP_DIR . "\n"; } // populate default dirs TestUtils::rcopy(TMP_DIR, DOKU_INC . '/conf'); TestUtils::rcopy(TMP_DIR, dirname(__FILE__) . '/conf'); mkdir(DOKU_TMP_DATA); foreach (array('attic', 'cache', 'index', 'locks', 'media', 'media_attic', 'media_meta', 'meta', 'pages', 'tmp') as $dir) { mkdir(DOKU_TMP_DATA . '/' . $dir); } // disable all non-default plugins by default $dh = dir(DOKU_INC . 'lib/plugins/'); while (false !== ($entry = $dh->read())) { if ($entry == '.' || $entry == '..') { continue; } if (!is_dir(DOKU_INC . 'lib/plugins/' . $entry)) { continue; } if (!in_array($entry, $default_plugins)) { // disable this plugin TestUtils::fappend(DOKU_CONF . 'plugins.local.php', "\$plugins['{$entry}'] = 0;\n"); } } $dh->close(); // load dw require_once DOKU_INC . 'inc/init.php'; // load the parser so $PARSER_MODES is defined before the tests start // otherwise PHPUnit unsets $PARSER_MODES in some cases which breaks p_get_parsermodes() require_once DOKU_INC . 'inc/parser/parser.php';
/** * Run unit tests selected via checkbox * @return TestGui */ public function runSelectedTests() { self::getAvailableTests(); // just to include all files if (array_key_exists('runtest', $_REQUEST)) { // logging require_once dirname(__FILE__) . DS . 'SimpleHtmlReporter.php'; $out = "\n" . str_repeat('=', 50) . "\nStarting tests, executed by user [" . self::getUserName() . "]. Deleted [" . TestUtils::flushTempDir() . "] files from temp dir [" . DIR_TEMP . "]\n" . str_repeat('=', 50); TestUtils::log($out, self::LOGNAME, TestUtils::LEVEL_INFO); $selected_tests = array(); foreach ($_REQUEST['runtest'] as $test_case => $methods) { if (is_array($methods)) { $selected_tests[$test_case] = array_keys($methods); } else { $this->errors[] = '<div class="alert alert-error">Caution - TestCase "' . $test_case . '" has no selected unit test.</div>'; } } $reporter = new SimpleHtmlReporter(); $reporter->setTests($selected_tests); $test_suite = new TestSuite(); foreach ($selected_tests as $class => $methods) { /** * @var WebTestCase */ $test_case = new $class(); // uprav nastavenia podla typu prostredia $modifier_class = $class . 'Set'; if (class_exists($modifier_class, false)) { // pozri priklad v testing/database.php $test_case = call_user_func(array($modifier_class, 'set'), $test_case); } $test_suite->add($test_case); } $test_suite->run($reporter); self::$output_result_tests = $reporter->getOutput(); // logging foreach ($reporter->getStatus() as $name => $test_case) { $log = '[' . $test_case['passed'] . '] passed, [' . $test_case['failed'] . '] failed for [' . $name . ']. Executed methods: ' . implode(', ', $test_case['methods']); if (sizeof($test_case['messages']) > 0) { $log .= "\n" . implode("\n", $test_case['messages']); } TestUtils::log(strip_tags($log), self::LOGNAME, TestUtils::LEVEL_INFO); } $timeMemory = " -- Execution time [" . TestUtils::execTime() . '], memory usage [' . TestUtils::getMemoryUsage() . ']'; TestUtils::log($timeMemory, self::LOGNAME, TestUtils::LEVEL_INFO); } return self::$instance; }
A::test(); B::test(); ExceptionHandler::registerPretty(); //print_r(B::$a); PsLibs::inst(); PsConnectionPool::configure(PsConnectionParams::sdkTest()); ps_admin_on(true); $a = array('a' => array('x' => 1, 'y' => 2)); $key = 'M'; $group = 'default'; $group2 = 'default2'; PSCache::inst()->saveToCache($a, $key, $group, 'xxx'); PSCache::inst()->saveToCache(array('a' => 1), '$key', '$group', 'xxx1'); die; echo TestUtils::testProductivity(function () { PSCache::inst()->getFromCache('$key', '$group', null, 'xxx1'); }); print_r(PSCache::inst()->getFromCache($key, $group, array('a'), 'xxx1')); die; print_r(PSCache::inst()->saveToCache($a, $key, $group)); print_r(PSCache::inst()->getFromCache($key, $group)); PSCache::inst()->removeFromCache($key, $group); print_r(PSCache::inst()->getFromCache($key, $group)); die; /* echo PsConnectionPool::params(); */ //print_r(PSDB::getRec('select * from blog_post where id_post=1')); //print_r(InflectsManager::inst()->getInflections('корыто')); //print_r(PsMathRebusSolver::solve('a+df=1aa'));
public static function setUpBeforeClass() { parent::setUpBeforeClass(); // copy the test data TestUtils::rcopy(TMP_DIR, dirname(__FILE__) . '/data/'); }
public static function setUpBeforeClass() { parent::setUpBeforeClass(); // copy our own config files to the test directory TestUtils::rcopy(dirname(DOKU_CONF), dirname(__FILE__) . '/conf'); }
public function setUp() { $testUtils = new TestUtils(Environment::SANDBOX); $this->panEligibilityService = new PanEligibilityService(TestUtils::SANDBOX_CONSUMER_KEY, $testUtils->getPrivateKey(), Environment::SANDBOX); }
public function testWhitelistAclGlobalInheritance() { $everyoneGroupXml = '<?xml version="1.0" encoding="UTF-8"?> <GroupList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="GroupList-1.0.0.xsd"> <Group> <Name>Everyone</Name> <Description>Built-in group to include all users</Description> </Group> </GroupList>'; $everyoneGroupBr = TestUtils::mockByteReader($this, $everyoneGroupXml); $this->assertEquals("text/xml", $everyoneGroupBr->GetMimeType()); $this->assertEquals($everyoneGroupXml, $everyoneGroupBr->ToString()); $site = $this->getMockBuilder("MgSite")->getMock(); $site->method("EnumerateGroups")->will($this->returnValue($everyoneGroupBr)); $roleMethodMap = array(array("Author", new FakeStringCollection(array("Author"))), array("Anonymous", new FakeStringCollection(array("Users"))), array("Administrator", new FakeStringCollection(array("Administrator")))); $site->method("EnumerateRoles")->will($this->returnValueMap($roleMethodMap)); //Everything not parcels is subject to the global rules //Any parcel action in the list with any representation is allowed if the calling user is part of any of the users/groups/roles specified $conf = array("Globals" => array("Actions" => array("SELECTFEATURES" => array("AllowRoles" => array("Author", "Administrator")))), "Library://Samples/Sheboygan/Data/Parcels.FeatureSource" => array("Actions" => array("SELECTFEATURES" => array("AllowUsers" => array("Author"), "AllowGroups" => array("Foo"), "AllowRoles" => array("Users"))), "Representations" => array("xml" => array("AllowUsers" => array("Administrator"), "AllowGroups" => array("Foo"), "AllowRoles" => array("Authors")), "json" => array("AllowUsers" => array("Author"), "AllowGroups" => array("Foo"), "AllowRoles" => array("Users"))))); $mimeType = "text/xml"; $resp = "json"; $wl = new MgWhitelist($conf); //Anonymous can't use SELECTFEATURES globally $action = "SELECTFEATURES"; $userName = "******"; $bExpect = true; $bForbidden = false; $wl->VerifyGlobalWhitelist($mimeType, function ($msg, $mt) use(&$bForbidden) { $bForbidden = true; }, $action, $resp, $site, $userName); $this->assertEquals($bExpect, $bForbidden, "Expected (" . ($bExpect ? "true" : "false") . ") on ({$action}, {$resp}) for {$userName}. Got: " . ($bForbidden ? "true" : "false")); //Author can use GETRESSELECTFEATURESOURCE globally $action = "SELECTFEATURES"; $userName = "******"; $bExpect = false; $bForbidden = false; $wl->VerifyGlobalWhitelist($mimeType, function ($msg, $mt) use(&$bForbidden) { $bForbidden = true; }, $action, $resp, $site, $userName); $this->assertEquals($bExpect, $bForbidden, "Expected (" . ($bExpect ? "true" : "false") . ") on ({$action}, {$resp}) for {$userName}. Got: " . ($bForbidden ? "true" : "false")); //Administrator can use SELECTFEATURES globally $action = "SELECTFEATURES"; $userName = "******"; $bExpect = false; $bForbidden = false; $wl->VerifyGlobalWhitelist($mimeType, function ($msg, $mt) use(&$bForbidden) { $bForbidden = true; }, $action, $resp, $site, $userName); $this->assertEquals($bExpect, $bForbidden, "Expected (" . ($bExpect ? "true" : "false") . ") on ({$action}, {$resp}) for {$userName}. Got: " . ($bForbidden ? "true" : "false")); //Test on trees. As the configuration has no entry for this, it should default to global configuration $resIdStr = "Library://Samples/Sheboygan/Data/Trees.FeatureSource"; //Anonymous can't use SELECTFEATURES on trees $action = "SELECTFEATURES"; $userName = "******"; $bExpect = true; $bForbidden = false; $wl->VerifyWhitelist($resIdStr, $mimeType, function ($msg, $mt) use(&$bForbidden) { $bForbidden = true; }, $action, $resp, $site, $userName); $this->assertEquals($bExpect, $bForbidden, "Expected (" . ($bExpect ? "true" : "false") . ") on ({$action}, {$resp}) for {$userName}. Got: " . ($bForbidden ? "true" : "false")); //Author can use SELECTFEATURES on trees $action = "SELECTFEATURES"; $userName = "******"; $bExpect = false; $bForbidden = false; $wl->VerifyWhitelist($resIdStr, $mimeType, function ($msg, $mt) use(&$bForbidden) { $bForbidden = true; }, $action, $resp, $site, $userName); $this->assertEquals($bExpect, $bForbidden, "Expected (" . ($bExpect ? "true" : "false") . ") on ({$action}, {$resp}) for {$userName}. Got: " . ($bForbidden ? "true" : "false")); //Administrator can use SELECTFEATURES on trees $action = "SELECTFEATURES"; $userName = "******"; $bExpect = false; $bForbidden = false; $wl->VerifyWhitelist($resIdStr, $mimeType, function ($msg, $mt) use(&$bForbidden) { $bForbidden = true; }, $action, $resp, $site, $userName); $this->assertEquals($bExpect, $bForbidden, "Expected (" . ($bExpect ? "true" : "false") . ") on ({$action}, {$resp}) for {$userName}. Got: " . ($bForbidden ? "true" : "false")); //Test on parcels $resIdStr = "Library://Samples/Sheboygan/Data/Parcels.FeatureSource"; //Anonymous can use SELECTFEATURES on trees $action = "SELECTFEATURES"; $userName = "******"; $bExpect = false; $bForbidden = false; $wl->VerifyWhitelist($resIdStr, $mimeType, function ($msg, $mt) use(&$bForbidden) { $bForbidden = true; }, $action, $resp, $site, $userName); $this->assertEquals($bExpect, $bForbidden, "Expected (" . ($bExpect ? "true" : "false") . ") on ({$action}, {$resp}) for {$userName}. Got: " . ($bForbidden ? "true" : "false")); //Author can use SELECTFEATURES on trees $action = "SELECTFEATURES"; $userName = "******"; $bExpect = false; $bForbidden = false; $wl->VerifyWhitelist($resIdStr, $mimeType, function ($msg, $mt) use(&$bForbidden) { $bForbidden = true; }, $action, $resp, $site, $userName); $this->assertEquals($bExpect, $bForbidden, "Expected (" . ($bExpect ? "true" : "false") . ") on ({$action}, {$resp}) for {$userName}. Got: " . ($bForbidden ? "true" : "false")); //Administrator can't use SELECTFEATURES on trees $action = "SELECTFEATURES"; $userName = "******"; $bExpect = true; $bForbidden = false; $wl->VerifyWhitelist($resIdStr, $mimeType, function ($msg, $mt) use(&$bForbidden) { $bForbidden = true; }, $action, $resp, $site, $userName); $this->assertEquals($bExpect, $bForbidden, "Expected (" . ($bExpect ? "true" : "false") . ") on ({$action}, {$resp}) for {$userName}. Got: " . ($bForbidden ? "true" : "false")); }
static function test15() { require '../OauthPanda.class.php'; $foo = new OauthPanda(array('exception_handling' => 'throw', 'request_client' => new YahooCurlWrapper('../YahooCurl.class.php'), 'oauth_client' => new StandardOauthWrapper('../OAuth.php'), 'consumer_key' => YAHOO_OAUTH_CONSUMER_KEY, 'consumer_secret' => YAHOO_OAUTH_CONSUMER_SECRET)); try { $response = $foo->GET(array('url' => 'https://api.login.yahoo.com/oauth/v2/get_request_token', 'params' => array('oauth_callback' => OAUTH_CALLBACK_URL))); //we should get a request token back TestUtils::assertTrue(false !== strpos($response['response_body'], 'oauth_token=')); } catch (Exception $e) { //no exception should be thrown TestUtils::assertTrue(false, '' . print_r($e, true)); } }
<?php $dir = __DIR__; require_once "{$dir}/../functions.php"; require_once "{$dir}/TestUtils.php"; TestUtils::checkFuncTrue("loadCSVTransactions", ["{$dir}/data/transaction_demo.csv"]); TestUtils::checkFuncTrue("removeExistingLinesInFile2FromFile1", ["{$dir}/data/file1", "{$dir}/data/file2"]); TestUtils::checkFuncTrue("isSumsCombinationExists", [[1, 2, 3, 4, 5], 9]); TestUtils::checkFuncFalse("isSumsCombinationExists", [[1, 14, 7, 9, 34, 26], 71]);
public function testUpdate3() { TestUtils::clearDatabase(); DatabaseHelper::getInstance()->insert('Contacts', array('Email' => '*****@*****.**', 'Phone' => '123', 'Name' => 'test1', 'Role' => ROLE_GUEST)); $contact = DatabaseHelper::getInstance()->getContactByEmail('*****@*****.**'); $this->assertTrue($contact !== false); $this->assertEquals('test1', $contact['Name']); $updatedData = array('Phone' => '987', 'Name' => null, 'Role' => ROLE_ADMINISTRATOR, 'Email' => null); DatabaseHelper::getInstance()->update('Contacts', $updatedData, 'id=?', array($contact['Id']), true); // Make sure only the relevant fields were changed $contact = DatabaseHelper::getInstance()->getContactByEmail('*****@*****.**'); $this->assertTrue($contact !== false); $this->assertEquals('test1', $contact['Name']); $this->assertEquals('987', $contact['Phone']); $this->assertEquals(ROLE_ADMINISTRATOR, $contact['Role']); }
public function setUp() { $testUtils = new TestUtils(Environment::SANDBOX); $this->deleteSubscriberIdService = new DeleteSubscriberIdService(TestUtils::SANDBOX_CONSUMER_KEY, $testUtils->getPrivateKey(), Environment::SANDBOX); }
public function setUp() { $testUtils = new TestUtils(Environment::SANDBOX); $this->merchantIdentifierService = new MerchantIdentifierService(TestUtils::SANDBOX_CONSUMER_KEY, $testUtils->getPrivateKey(), Environment::SANDBOX); }
public function setUp() { $testUtils = new TestUtils(Environment::SANDBOX); $this->transferReversalService = new TransferReversalService(TestUtils::SANDBOX_CONSUMER_KEY, $testUtils->getPrivateKey(), Environment::SANDBOX); }
public function setUp() { $testUtils = new TestUtils(Environment::SANDBOX); $this->LostStolenService = new LostStolenService(TestUtils::SANDBOX_CONSUMER_KEY, $testUtils->getPrivateKey(), Environment::SANDBOX); $this->account = new Account(); }