/** * @dataProvider getAcceptableOriginsTestData * @group Core * @group Nonce */ public function test_getAcceptableOrigins($host, $expected) { Piwik_Config::getInstance()->General['enable_trusted_host_check'] = 0; $_SERVER['HTTP_HOST'] = $host; Piwik_Config::getInstance()->General['trusted_hosts'] = array('example.com'); $this->assertEquals($expected, Piwik_Nonce::getAcceptableOrigins(), $host); }
public function test_getAcceptableOrigins() { Piwik::createConfigObject(); Piwik_Config::getInstance()->setTestEnvironment(); $tests = array('example.com' => array('http://example.com', 'https://example.com'), 'example.com:80' => array('http://example.com', 'https://example.com'), 'example.com:443' => array('http://example.com', 'https://example.com'), 'example.com:8080' => array('http://example.com', 'https://example.com', 'http://example.com:8080', 'https://example.com:8080')); foreach ($tests as $host => $expected) { $_SERVER['HTTP_HOST'] = $host; $this->assertEqual(Piwik_Nonce::getAcceptableOrigins(), $expected, $host); } }
/** * @dataProvider getAcceptableOriginsTestData * @group Core * @group Nonce */ public function test_getAcceptableOrigins($host, $expected) { $_SERVER['HTTP_HOST'] = $host; $this->assertEquals($expected, Piwik_Nonce::getAcceptableOrigins(), $host); }