CURL = new MODULE_CURL(); $this->NETWORK = new MODULE_NETWORK(); } /** * @test * @testdox Run in a platform (deprecated) and make sure follows are disabled per default * @throws \Exception */ public function followRedirectSafeMode() { // http://php.net/manual/en/ini.sect.safe-mode.php if (version_compare(PHP_VERSION, "5.4.0", ">=")) { static::markTestSkipped("Safe mode has been removed from this platform, so tests can not be performed"); return; } $this->__setUp(); if (filter_var(ini_get('safe_mode'), FILTER_VALIDATE_BOOLEAN) === true) { //$this->pemDefault(); $redirectResponse = $this->CURL->doGet("http://tests.netcurl.org/tornevall_network/redirect.php?run"); $redirectedUrls = $this->CURL->getRedirectedUrls(); static::assertTrue( $this->CURL->getCode($redirectResponse) >= 300 && $this->CURL->getCode($redirectResponse) <= 350 && !preg_match("/rerun/i", $this->CURL->getBody($redirectResponse)) && count($redirectedUrls) ); return; } static::markTestSkipped("Safe mode is available as an option. It is however not enabled on this platform and can not therefore be tested."); } /** * @test * @testdox Test proxy by using Tor Network (Requires Tor) * @link https://www.torproject.org/ Required application * @throws \Exception */ public function torNetwork() { $this->__setUp(); exec("service tor status", $ubuntuService); $serviceFound = false; foreach ($ubuntuService as $row) { // Unsafe control if (preg_match("/loaded: loaded/i", $row)) { $serviceFound = true; } } if (!$serviceFound) { static::markTestSkipped("Skip TOR Network tests: TOR Service not found in the current control"); return; } else { $this->CURL->setProxy($this->TorSetupAddress, $this->TorSetupType); $this->CURL->doGet(\TESTURLS::getUrlSimpleJson()); $parsedIp = $this->NETWORK->getArpaFromAddr($this->CURL->getParsed()->ip, true); static::assertTrue($parsedIp > 0); } } }