Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into overridablelangstrings
Conflicts: inc/plugin.php
- Loading branch information
Showing
400 changed files
with
24,391 additions
and
17,458 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
|
||
class cli_options extends DokuWikiTest { | ||
|
||
function test_simpleshort() { | ||
$options = new DokuCLI_Options(); | ||
$options->registerOption('exclude', 'exclude files', 'x', 'file'); | ||
|
||
$options->args = array('-x', 'foo', 'bang'); | ||
$options->parseOptions(); | ||
|
||
$this->assertEquals('foo', $options->getOpt('exclude')); | ||
$this->assertEquals(array('bang'), $options->args); | ||
$this->assertFalse($options->getOpt('nothing')); | ||
} | ||
|
||
function test_simplelong1() { | ||
$options = new DokuCLI_Options(); | ||
$options->registerOption('exclude', 'exclude files', 'x', 'file'); | ||
|
||
$options->args = array('--exclude', 'foo', 'bang'); | ||
$options->parseOptions(); | ||
|
||
$this->assertEquals('foo', $options->getOpt('exclude')); | ||
$this->assertEquals(array('bang'), $options->args); | ||
$this->assertFalse($options->getOpt('nothing')); | ||
} | ||
|
||
function test_simplelong2() { | ||
$options = new DokuCLI_Options(); | ||
$options->registerOption('exclude', 'exclude files', 'x', 'file'); | ||
|
||
$options->args = array('--exclude=foo', 'bang'); | ||
$options->parseOptions(); | ||
|
||
$this->assertEquals('foo', $options->getOpt('exclude')); | ||
$this->assertEquals(array('bang'), $options->args); | ||
$this->assertFalse($options->getOpt('nothing')); | ||
} | ||
|
||
function test_complex() { | ||
$options = new DokuCLI_Options(); | ||
|
||
$options->registerOption('plugins', 'run on plugins only', 'p'); | ||
$options->registerCommand('status', 'display status info'); | ||
$options->registerOption('long', 'display long lines', 'l', false, 'status'); | ||
|
||
$options->args = array('-p', 'status', '--long', 'foo'); | ||
$options->parseOptions(); | ||
|
||
$this->assertEquals('status', $options->getCmd()); | ||
$this->assertTrue($options->getOpt('plugins')); | ||
$this->assertTrue($options->getOpt('long')); | ||
$this->assertEquals(array('foo'), $options->args); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<?php | ||
|
||
class init_checkssl_test extends DokuWikiTest { | ||
|
||
/** | ||
* Running behind an SSL proxy, HTTP between server and proxy | ||
* HTTPS not set | ||
* HTTP_X_FORWARDED_PROTO | ||
* set to https | ||
*/ | ||
function test1() { | ||
$_SERVER['HTTP_X_FORWARDED_PROTO'] = 'https'; | ||
|
||
$this->assertEquals(is_ssl(), true); | ||
} | ||
|
||
/** | ||
* Running behind a plain HTTP proxy, HTTP between server and proxy | ||
* HTTPS not set | ||
* HTTP_X_FORWARDED_PROTO set to http | ||
*/ | ||
function test2() { | ||
$_SERVER['HTTP_X_FORWARDED_PROTO'] = 'http'; | ||
|
||
$this->assertEquals(is_ssl(), false); | ||
} | ||
|
||
/** | ||
* Running behind an SSL proxy, HTTP between server and proxy | ||
* HTTPS set to off, | ||
* HTTP_X_FORWARDED_PROTO set to https | ||
*/ | ||
function test3() { | ||
$_SERVER['HTTP_X_FORWARDED_PROTO'] = 'https'; | ||
$_SERVER['HTTPS'] = 'off'; | ||
|
||
$this->assertEquals(is_ssl(), true); | ||
} | ||
|
||
/** | ||
* Not running behind a proxy, HTTPS server | ||
* HTTPS set to on, | ||
* HTTP_X_FORWARDED_PROTO not set | ||
*/ | ||
function test4() { | ||
$_SERVER['HTTPS'] = 'on'; | ||
|
||
$this->assertEquals(is_ssl(), true); | ||
} | ||
|
||
/** | ||
* Not running behind a proxy, plain HTTP server | ||
* HTTPS not set | ||
* HTTP_X_FORWARDED_PROTO not set | ||
*/ | ||
function test5() { | ||
$this->assertEquals(is_ssl(), false); | ||
} | ||
|
||
/** | ||
* Not running behind a proxy, plain HTTP server | ||
* HTTPS set to off | ||
* HTTP_X_FORWARDED_PROTO not set | ||
*/ | ||
function test6() { | ||
$_SERVER['HTTPS'] = 'off'; | ||
$this->assertEquals(is_ssl(), false); | ||
} | ||
|
||
/** | ||
* Running behind an SSL proxy, SSL between proxy and HTTP server | ||
* HTTPS set to on, | ||
* HTTP_X_FORWARDED_PROTO set to https | ||
*/ | ||
function test7() { | ||
$_SERVER['HTTP_X_FORWARDED_PROTO'] = 'https'; | ||
$_SERVER['HTTPS'] = 'on'; | ||
|
||
$this->assertEquals(is_ssl(), true); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.