Skip to content
Snippets Groups Projects
Commit 0063cdfc authored by Laurent's avatar Laurent
Browse files

Merge branch 'hotline-master'

parents 2efe7cbd e7b35ada
Branches
Tags
1 merge request!2334Master
- ticket #57929 : Liens permanents : sur un accès en https, Bokeh n'ajoute plus le port par défaut (:443)
18/05/2017 - v7.9.19
- ticket #60547 : Cosmogramme : correction d'erreurs dans les écrans de configuration des intégrations, d'analyse de fichier unimarc et de modifications des codifications Dewey et PCDM4
......
......@@ -113,6 +113,9 @@ class Class_Url {
public static function getPort() {
$port = isset($_SERVER['SERVER_PORT']) ? $_SERVER['SERVER_PORT'] : 80;
if (static::isSecure() && 443 == $port)
return '';
return $port == 80 ? '' : ':' . $port;
}
......
......@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class UrlBaseUrlTest extends ModelTestCase {
abstract class UrlTestCase extends ModelTestCase {
protected
$_storm_default_to_volatile = true,
$_server_backup;
......@@ -31,12 +31,16 @@ class UrlBaseUrlTest extends ModelTestCase {
$this->_server_backup = $_SERVER;
}
public function tearDown() {
$_SERVER = $this->_server_backup;
parent::tearDown();
}
}
class UrlBaseUrlTest extends UrlTestCase {
/** @test */
public function bokehInstalledInASubdirectory() {
$_SERVER['SCRIPT_NAME'] = '/home/tom/public_html/bokeh/index.php';
......@@ -63,8 +67,39 @@ class UrlBaseUrlTest extends ModelTestCase {
/** @test */
public function absoluteUrlShouldReturnCorrectSyntax() {
$this->assertContains('http://' . $_SERVER['SERVER_NAME'] . '/', Class_Url::absolute(['module' => 'admin',
'controller' => 'cms',
'action' => 'index']));
$this->assertContains('http://' . $_SERVER['SERVER_NAME'] . '/',
Class_Url::absolute(['module' => 'admin',
'controller' => 'cms',
'action' => 'index']));
}
}
/** @see http://forge.afi-sa.fr/issues/57929 */
class UrlHttpsTest extends UrlTestCase {
public function setUp() {
parent::setUp();
$_SERVER['HTTPS'] = 'on';
}
/** @test */
public function absoluteUrlShouldNotRepeatDefaultPort() {
$_SERVER['SERVER_PORT'] = '443';
$this->assertNotContains(':443',
Class_Url::absolute(['module' => 'opac',
'controller' => 'recherche',
'action' => 'viewnotice']));
}
/** @test */
public function absoluteUrlShouldInsertExoticPort() {
$_SERVER['SERVER_PORT'] = '4433';
$this->assertContains(':4433',
Class_Url::absolute(['module' => 'opac',
'controller' => 'recherche',
'action' => 'viewnotice']));
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment