185becf1bSAndreas Gohr<?php 25b5c8486SAndreas Gohr 35b5c8486SAndreas Gohrnamespace plugin\farmer\test; 485becf1bSAndreas Gohr 585becf1bSAndreas Gohrrequire_once(__DIR__ . '/../DokuWikiFarmCore.php'); 685becf1bSAndreas Gohr 75b5c8486SAndreas Gohrclass DokuWikiFarmCore extends \DokuWikiFarmCore 85b5c8486SAndreas Gohr{ 95b5c8486SAndreas Gohr /** @noinspection PhpMissingParentConstructorInspection */ 105b5c8486SAndreas Gohr public function __construct() 115b5c8486SAndreas Gohr { 125b5c8486SAndreas Gohr $this->loadConfig(); 135b5c8486SAndreas Gohr // we do not intitialize anyting else here because it's already too late and DOKU_INC is already set 145b5c8486SAndreas Gohr } 155b5c8486SAndreas Gohr 165b5c8486SAndreas Gohr public function getAnimalNamesForHost($host) 175b5c8486SAndreas Gohr { 1885becf1bSAndreas Gohr return parent::getAnimalNamesForHost($host); 1985becf1bSAndreas Gohr } 20*83ef0d71SAndreas Gohr 21*83ef0d71SAndreas Gohr public function detectAnimal($sapi = null) 22*83ef0d71SAndreas Gohr { 23*83ef0d71SAndreas Gohr parent::detectAnimal($sapi); 24*83ef0d71SAndreas Gohr } 25*83ef0d71SAndreas Gohr 26*83ef0d71SAndreas Gohr public function setConfig($config) 27*83ef0d71SAndreas Gohr { 28*83ef0d71SAndreas Gohr $this->config = $config; 29*83ef0d71SAndreas Gohr } 30*83ef0d71SAndreas Gohr 31*83ef0d71SAndreas Gohr public function getAnimal() 32*83ef0d71SAndreas Gohr { 33*83ef0d71SAndreas Gohr return $this->animal; 34*83ef0d71SAndreas Gohr } 35*83ef0d71SAndreas Gohr 36*83ef0d71SAndreas Gohr public function wasNotfound() 37*83ef0d71SAndreas Gohr { 38*83ef0d71SAndreas Gohr return $this->notfound; 39*83ef0d71SAndreas Gohr } 40*83ef0d71SAndreas Gohr 41*83ef0d71SAndreas Gohr public function isHostbased() 42*83ef0d71SAndreas Gohr { 43*83ef0d71SAndreas Gohr return $this->hostbased; 44*83ef0d71SAndreas Gohr } 45*83ef0d71SAndreas Gohr 46*83ef0d71SAndreas Gohr public function resetState() 47*83ef0d71SAndreas Gohr { 48*83ef0d71SAndreas Gohr $this->animal = false; 49*83ef0d71SAndreas Gohr $this->notfound = false; 50*83ef0d71SAndreas Gohr $this->hostbased = false; 51*83ef0d71SAndreas Gohr } 52*83ef0d71SAndreas Gohr 53*83ef0d71SAndreas Gohr public function injectServerEnvironment(array $urlparts) 54*83ef0d71SAndreas Gohr { 55*83ef0d71SAndreas Gohr parent::injectServerEnvironment($urlparts); 56*83ef0d71SAndreas Gohr } 5785becf1bSAndreas Gohr} 5885becf1bSAndreas Gohr 5985becf1bSAndreas Gohr 6085becf1bSAndreas Gohr/** 6185becf1bSAndreas Gohr * @group plugin_farmer 6285becf1bSAndreas Gohr * @group plugins 6385becf1bSAndreas Gohr */ 645b5c8486SAndreas Gohrclass core_plugin_farmer_test extends \DokuWikiTest 655b5c8486SAndreas Gohr{ 6685becf1bSAndreas Gohr 675b5c8486SAndreas Gohr protected $pluginsEnabled = ['farmer']; 6885becf1bSAndreas Gohr 6985becf1bSAndreas Gohr 70*83ef0d71SAndreas Gohr /** 71*83ef0d71SAndreas Gohr * Test the getAnimalNamesForHost method 72*83ef0d71SAndreas Gohr */ 735b5c8486SAndreas Gohr public function test_hostsAnimals() 745b5c8486SAndreas Gohr { 7585becf1bSAndreas Gohr $core = new DokuWikiFarmCore(); 7685becf1bSAndreas Gohr 7785becf1bSAndreas Gohr $input = 'www.foobar.example.com:8000'; 785b5c8486SAndreas Gohr $expect = [ 7985becf1bSAndreas Gohr 'www.foobar.example.com.8000', 8085becf1bSAndreas Gohr 'foobar.example.com.8000', 8185becf1bSAndreas Gohr 'www.foobar.example.com', 8285becf1bSAndreas Gohr 'foobar.example.com', 83bfecda9bSAndreas Gohr 'www.foobar.example', 8485becf1bSAndreas Gohr 'foobar.example', 8585becf1bSAndreas Gohr 'www.foobar', 8685becf1bSAndreas Gohr 'foobar', 8785becf1bSAndreas Gohr 'www', 885b5c8486SAndreas Gohr ]; 8985becf1bSAndreas Gohr 9085becf1bSAndreas Gohr $this->assertEquals($expect, $core->getAnimalNamesForHost($input)); 9185becf1bSAndreas Gohr } 92*83ef0d71SAndreas Gohr 93*83ef0d71SAndreas Gohr /** 94*83ef0d71SAndreas Gohr * Data provider for detectAnimal tests 95*83ef0d71SAndreas Gohr */ 96*83ef0d71SAndreas Gohr public function detectAnimalProvider() 97*83ef0d71SAndreas Gohr { 98*83ef0d71SAndreas Gohr return [ 99*83ef0d71SAndreas Gohr 'animal via GET parameter - exists' => [ 100*83ef0d71SAndreas Gohr 'get_params' => ['animal' => 'testanimal'], 101*83ef0d71SAndreas Gohr 'server_params' => [], 102*83ef0d71SAndreas Gohr 'sapi' => 'apache2handler', 103*83ef0d71SAndreas Gohr 'expected_animal' => 'testanimal', 104*83ef0d71SAndreas Gohr 'expected_notfound' => false, 105*83ef0d71SAndreas Gohr 'expected_hostbased' => false, 106*83ef0d71SAndreas Gohr 'create_dirs' => ['/tmp/farm/testanimal/conf'], 107*83ef0d71SAndreas Gohr ], 108*83ef0d71SAndreas Gohr 'animal via GET parameter - not found' => [ 109*83ef0d71SAndreas Gohr 'get_params' => ['animal' => 'nonexistent'], 110*83ef0d71SAndreas Gohr 'server_params' => [], 111*83ef0d71SAndreas Gohr 'sapi' => 'apache2handler', 112*83ef0d71SAndreas Gohr 'expected_animal' => false, 113*83ef0d71SAndreas Gohr 'expected_notfound' => true, 114*83ef0d71SAndreas Gohr 'expected_hostbased' => false, 115*83ef0d71SAndreas Gohr ], 116*83ef0d71SAndreas Gohr 'animal via GET parameter - invalid path' => [ 117*83ef0d71SAndreas Gohr 'get_params' => ['animal' => '../badpath'], 118*83ef0d71SAndreas Gohr 'server_params' => [], 119*83ef0d71SAndreas Gohr 'sapi' => 'apache2handler', 120*83ef0d71SAndreas Gohr 'expected_animal' => false, 121*83ef0d71SAndreas Gohr 'expected_notfound' => true, 122*83ef0d71SAndreas Gohr 'expected_hostbased' => false, 123*83ef0d71SAndreas Gohr ], 124*83ef0d71SAndreas Gohr 'farmer host' => [ 125*83ef0d71SAndreas Gohr 'get_params' => [], 126*83ef0d71SAndreas Gohr 'server_params' => ['HTTP_HOST' => 'farm.example.com'], 127*83ef0d71SAndreas Gohr 'sapi' => 'apache2handler', 128*83ef0d71SAndreas Gohr 'expected_animal' => false, 129*83ef0d71SAndreas Gohr 'expected_notfound' => false, 130*83ef0d71SAndreas Gohr 'expected_hostbased' => false, 131*83ef0d71SAndreas Gohr ], 132*83ef0d71SAndreas Gohr 'host-based animal - exists' => [ 133*83ef0d71SAndreas Gohr 'get_params' => [], 134*83ef0d71SAndreas Gohr 'server_params' => ['HTTP_HOST' => 'sub.example.com'], 135*83ef0d71SAndreas Gohr 'sapi' => 'apache2handler', 136*83ef0d71SAndreas Gohr 'expected_animal' => 'sub.example.com', 137*83ef0d71SAndreas Gohr 'expected_notfound' => false, 138*83ef0d71SAndreas Gohr 'expected_hostbased' => true, 139*83ef0d71SAndreas Gohr 'create_dirs' => ['/tmp/farm/sub.example.com/conf'], 140*83ef0d71SAndreas Gohr ], 141*83ef0d71SAndreas Gohr 'host-based animal - not found' => [ 142*83ef0d71SAndreas Gohr 'get_params' => [], 143*83ef0d71SAndreas Gohr 'server_params' => ['HTTP_HOST' => 'unknown.example.com'], 144*83ef0d71SAndreas Gohr 'sapi' => 'apache2handler', 145*83ef0d71SAndreas Gohr 'expected_animal' => false, 146*83ef0d71SAndreas Gohr 'expected_notfound' => true, 147*83ef0d71SAndreas Gohr 'expected_hostbased' => true, 148*83ef0d71SAndreas Gohr ], 149*83ef0d71SAndreas Gohr 'CLI animal parameter - name only' => [ 150*83ef0d71SAndreas Gohr 'get_params' => [], 151*83ef0d71SAndreas Gohr 'server_params' => ['animal' => 'clianimal'], 152*83ef0d71SAndreas Gohr 'sapi' => 'cli', 153*83ef0d71SAndreas Gohr 'expected_animal' => 'clianimal', 154*83ef0d71SAndreas Gohr 'expected_notfound' => false, 155*83ef0d71SAndreas Gohr 'expected_hostbased' => false, 156*83ef0d71SAndreas Gohr 'create_dirs' => ['/tmp/farm/clianimal/conf'], 157*83ef0d71SAndreas Gohr ], 158*83ef0d71SAndreas Gohr 'CLI animal parameter - URL with query' => [ 159*83ef0d71SAndreas Gohr 'get_params' => [], 160*83ef0d71SAndreas Gohr 'server_params' => ['animal' => 'https://example.com/path?animal=urlanimal&other=param'], 161*83ef0d71SAndreas Gohr 'sapi' => 'cli', 162*83ef0d71SAndreas Gohr 'expected_animal' => 'urlanimal', 163*83ef0d71SAndreas Gohr 'expected_notfound' => false, 164*83ef0d71SAndreas Gohr 'expected_hostbased' => false, 165*83ef0d71SAndreas Gohr 'create_dirs' => ['/tmp/farm/urlanimal/conf'], 166*83ef0d71SAndreas Gohr ], 167*83ef0d71SAndreas Gohr 'CLI animal parameter - URL with bang path' => [ 168*83ef0d71SAndreas Gohr 'get_params' => [], 169*83ef0d71SAndreas Gohr 'server_params' => ['animal' => 'https://example.com/!banganimal/page'], 170*83ef0d71SAndreas Gohr 'sapi' => 'cli', 171*83ef0d71SAndreas Gohr 'expected_animal' => 'banganimal', 172*83ef0d71SAndreas Gohr 'expected_notfound' => false, 173*83ef0d71SAndreas Gohr 'expected_hostbased' => false, 174*83ef0d71SAndreas Gohr 'create_dirs' => ['/tmp/farm/banganimal/conf'], 175*83ef0d71SAndreas Gohr ], 176*83ef0d71SAndreas Gohr 'CLI animal parameter - URL with bang path in subdir' => [ 177*83ef0d71SAndreas Gohr 'get_params' => [], 178*83ef0d71SAndreas Gohr 'server_params' => ['animal' => 'https://example.com/dokuwiki/!banganimal/page'], 179*83ef0d71SAndreas Gohr 'sapi' => 'cli', 180*83ef0d71SAndreas Gohr 'expected_animal' => 'banganimal', 181*83ef0d71SAndreas Gohr 'expected_notfound' => false, 182*83ef0d71SAndreas Gohr 'expected_hostbased' => false, 183*83ef0d71SAndreas Gohr 'create_dirs' => ['/tmp/farm/banganimal/conf'], 184*83ef0d71SAndreas Gohr ], 185*83ef0d71SAndreas Gohr 'CLI animal parameter - URL with hostname' => [ 186*83ef0d71SAndreas Gohr 'get_params' => [], 187*83ef0d71SAndreas Gohr 'server_params' => ['animal' => 'https://hostanimal.example.com/page'], 188*83ef0d71SAndreas Gohr 'sapi' => 'cli', 189*83ef0d71SAndreas Gohr 'expected_animal' => 'hostanimal.example.com', 190*83ef0d71SAndreas Gohr 'expected_notfound' => false, 191*83ef0d71SAndreas Gohr 'expected_hostbased' => true, 192*83ef0d71SAndreas Gohr 'create_dirs' => ['/tmp/farm/hostanimal.example.com/conf'], 193*83ef0d71SAndreas Gohr ], 194*83ef0d71SAndreas Gohr 'CLI no animal parameter' => [ 195*83ef0d71SAndreas Gohr 'get_params' => [], 196*83ef0d71SAndreas Gohr 'server_params' => [], 197*83ef0d71SAndreas Gohr 'sapi' => 'cli', 198*83ef0d71SAndreas Gohr 'expected_animal' => false, 199*83ef0d71SAndreas Gohr 'expected_notfound' => false, 200*83ef0d71SAndreas Gohr 'expected_hostbased' => false, 201*83ef0d71SAndreas Gohr ], 202*83ef0d71SAndreas Gohr 'CLI animal parameter - URL with bang and query' => [ 203*83ef0d71SAndreas Gohr 'get_params' => [], 204*83ef0d71SAndreas Gohr 'server_params' => ['animal' => 'https://example.com/!bangquery/page?param=value'], 205*83ef0d71SAndreas Gohr 'sapi' => 'cli', 206*83ef0d71SAndreas Gohr 'expected_animal' => 'bangquery', 207*83ef0d71SAndreas Gohr 'expected_notfound' => false, 208*83ef0d71SAndreas Gohr 'expected_hostbased' => false, 209*83ef0d71SAndreas Gohr 'create_dirs' => ['/tmp/farm/bangquery/conf'], 210*83ef0d71SAndreas Gohr ], 211*83ef0d71SAndreas Gohr 'HTTP no host header' => [ 212*83ef0d71SAndreas Gohr 'get_params' => [], 213*83ef0d71SAndreas Gohr 'server_params' => ['HTTP_HOST' => ''], // our test environment sets one 214*83ef0d71SAndreas Gohr 'sapi' => 'apache2handler', 215*83ef0d71SAndreas Gohr 'expected_animal' => false, 216*83ef0d71SAndreas Gohr 'expected_notfound' => false, 217*83ef0d71SAndreas Gohr 'expected_hostbased' => false, 218*83ef0d71SAndreas Gohr ], 219*83ef0d71SAndreas Gohr ]; 220*83ef0d71SAndreas Gohr } 221*83ef0d71SAndreas Gohr 222*83ef0d71SAndreas Gohr /** 223*83ef0d71SAndreas Gohr * @dataProvider detectAnimalProvider 224*83ef0d71SAndreas Gohr * @param array $get_params GET parameters to set in $_GET 225*83ef0d71SAndreas Gohr * @param array $server_params SERVER parameters to set in $_SERVER 226*83ef0d71SAndreas Gohr * @param string $sapi SAPI to simulate 227*83ef0d71SAndreas Gohr * @param string|false $expected_animal Expected animal name or false 228*83ef0d71SAndreas Gohr * @param bool $expected_notfound Expected notfound state 229*83ef0d71SAndreas Gohr * @param bool $expected_hostbased Expected hostbased state 230*83ef0d71SAndreas Gohr * @param array $create_dirs Directories to create for the test 231*83ef0d71SAndreas Gohr */ 232*83ef0d71SAndreas Gohr public function test_detectAnimal($get_params, $server_params, $sapi, $expected_animal, $expected_notfound, $expected_hostbased, $create_dirs = []) 233*83ef0d71SAndreas Gohr { 234*83ef0d71SAndreas Gohr // Create temporary directories if needed 235*83ef0d71SAndreas Gohr foreach ($create_dirs as $dir) { 236*83ef0d71SAndreas Gohr if (!is_dir($dir)) { 237*83ef0d71SAndreas Gohr mkdir($dir, 0755, true); 238*83ef0d71SAndreas Gohr } 239*83ef0d71SAndreas Gohr } 240*83ef0d71SAndreas Gohr 241*83ef0d71SAndreas Gohr // Backup original values 242*83ef0d71SAndreas Gohr $original_get = $_GET; 243*83ef0d71SAndreas Gohr $original_server = $_SERVER; 244*83ef0d71SAndreas Gohr $original_query_string = $_SERVER['QUERY_STRING'] ?? ''; 245*83ef0d71SAndreas Gohr 246*83ef0d71SAndreas Gohr try { 247*83ef0d71SAndreas Gohr // Set up test environment 248*83ef0d71SAndreas Gohr $_GET = array_merge($_GET, $get_params); 249*83ef0d71SAndreas Gohr $_SERVER = array_merge($_SERVER, $server_params); 250*83ef0d71SAndreas Gohr if (!empty($get_params)) { 251*83ef0d71SAndreas Gohr $_SERVER['QUERY_STRING'] = http_build_query($get_params); 252*83ef0d71SAndreas Gohr } 253*83ef0d71SAndreas Gohr 254*83ef0d71SAndreas Gohr $config = ['base' => ['farmdir' => '/tmp/farm', 'farmhost' => 'farm.example.com']]; 255*83ef0d71SAndreas Gohr $core = new DokuWikiFarmCore(); 256*83ef0d71SAndreas Gohr $core->setConfig($config); 257*83ef0d71SAndreas Gohr $core->resetState(); 258*83ef0d71SAndreas Gohr $core->detectAnimal($sapi); 259*83ef0d71SAndreas Gohr 260*83ef0d71SAndreas Gohr $this->assertEquals($expected_animal, $core->getAnimal(), 'Animal detection failed'); 261*83ef0d71SAndreas Gohr $this->assertEquals($expected_notfound, $core->wasNotfound(), 'Notfound state incorrect'); 262*83ef0d71SAndreas Gohr $this->assertEquals($expected_hostbased, $core->isHostbased(), 'Hostbased state incorrect'); 263*83ef0d71SAndreas Gohr 264*83ef0d71SAndreas Gohr } finally { 265*83ef0d71SAndreas Gohr // Restore original values 266*83ef0d71SAndreas Gohr $_GET = $original_get; 267*83ef0d71SAndreas Gohr $_SERVER = $original_server; 268*83ef0d71SAndreas Gohr $_SERVER['QUERY_STRING'] = $original_query_string; 269*83ef0d71SAndreas Gohr 270*83ef0d71SAndreas Gohr // Clean up created directories 271*83ef0d71SAndreas Gohr foreach ($create_dirs as $dir) { 272*83ef0d71SAndreas Gohr if (is_dir($dir)) { 273*83ef0d71SAndreas Gohr rmdir($dir); 274*83ef0d71SAndreas Gohr // Also remove parent directories if they're empty 275*83ef0d71SAndreas Gohr $parent = dirname($dir); 276*83ef0d71SAndreas Gohr while ($parent !== '/' && $parent !== '.' && is_dir($parent) && count(scandir($parent)) === 2) { 277*83ef0d71SAndreas Gohr rmdir($parent); 278*83ef0d71SAndreas Gohr $parent = dirname($parent); 279*83ef0d71SAndreas Gohr } 280*83ef0d71SAndreas Gohr } 281*83ef0d71SAndreas Gohr } 282*83ef0d71SAndreas Gohr } 283*83ef0d71SAndreas Gohr } 284*83ef0d71SAndreas Gohr 285*83ef0d71SAndreas Gohr /** 286*83ef0d71SAndreas Gohr * Data provider for injectServerEnvironment tests 287*83ef0d71SAndreas Gohr */ 288*83ef0d71SAndreas Gohr public function injectServerEnvironmentProvider() 289*83ef0d71SAndreas Gohr { 290*83ef0d71SAndreas Gohr return [ 291*83ef0d71SAndreas Gohr 'HTTPS URL with port' => [ 292*83ef0d71SAndreas Gohr 'url' => 'https://example.com:8443/dokuwiki/doku.php', 293*83ef0d71SAndreas Gohr 'expected_baseurl' => 'https://example.com:8443', 294*83ef0d71SAndreas Gohr 'expected_basedir' => '/dokuwiki/', 295*83ef0d71SAndreas Gohr ], 296*83ef0d71SAndreas Gohr 'HTTP URL with default port' => [ 297*83ef0d71SAndreas Gohr 'url' => 'http://test.example.com/doku.php', 298*83ef0d71SAndreas Gohr 'expected_baseurl' => 'http://test.example.com', 299*83ef0d71SAndreas Gohr 'expected_basedir' => '/', 300*83ef0d71SAndreas Gohr ], 301*83ef0d71SAndreas Gohr 'HTTPS URL with bang path' => [ 302*83ef0d71SAndreas Gohr 'url' => 'https://farm.example.com/!animal/doku.php', 303*83ef0d71SAndreas Gohr 'expected_baseurl' => 'https://farm.example.com', 304*83ef0d71SAndreas Gohr 'expected_basedir' => '/', 305*83ef0d71SAndreas Gohr ], 306*83ef0d71SAndreas Gohr 'HTTP URL with subdirectory and bang path' => [ 307*83ef0d71SAndreas Gohr 'url' => 'http://wiki.example.com/dokuwiki/!testanimal/start', 308*83ef0d71SAndreas Gohr 'expected_baseurl' => 'http://wiki.example.com', 309*83ef0d71SAndreas Gohr 'expected_basedir' => '/dokuwiki/', 310*83ef0d71SAndreas Gohr ], 311*83ef0d71SAndreas Gohr 'HTTPS URL with custom port and path' => [ 312*83ef0d71SAndreas Gohr 'url' => 'https://secure.example.com:9443/wiki', 313*83ef0d71SAndreas Gohr 'expected_baseurl' => 'https://secure.example.com:9443', 314*83ef0d71SAndreas Gohr 'expected_basedir' => '/wiki/', 315*83ef0d71SAndreas Gohr ], 316*83ef0d71SAndreas Gohr 'HTTP URL with root path' => [ 317*83ef0d71SAndreas Gohr 'url' => 'http://simple.example.com/', 318*83ef0d71SAndreas Gohr 'expected_baseurl' => 'http://simple.example.com', 319*83ef0d71SAndreas Gohr 'expected_basedir' => '/', 320*83ef0d71SAndreas Gohr ], 321*83ef0d71SAndreas Gohr 'HTTP URL with no path' => [ 322*83ef0d71SAndreas Gohr 'url' => 'http://simple.example.com', 323*83ef0d71SAndreas Gohr 'expected_baseurl' => 'http://simple.example.com', 324*83ef0d71SAndreas Gohr 'expected_basedir' => '/', 325*83ef0d71SAndreas Gohr ], 326*83ef0d71SAndreas Gohr ]; 327*83ef0d71SAndreas Gohr } 328*83ef0d71SAndreas Gohr 329*83ef0d71SAndreas Gohr /** 330*83ef0d71SAndreas Gohr * @dataProvider injectServerEnvironmentProvider 331*83ef0d71SAndreas Gohr * @param string $url The URL to parse and inject 332*83ef0d71SAndreas Gohr * @param string $expected_baseurl Expected base URL after injection 333*83ef0d71SAndreas Gohr * @param string $expected_basedir Expected base directory after injection 334*83ef0d71SAndreas Gohr */ 335*83ef0d71SAndreas Gohr public function test_injectServerEnvironment($url, $expected_baseurl, $expected_basedir) 336*83ef0d71SAndreas Gohr { 337*83ef0d71SAndreas Gohr // Clear relevant server variables 338*83ef0d71SAndreas Gohr unset($_SERVER['HTTPS'], $_SERVER['HTTP_HOST'], $_SERVER['SCRIPT_NAME']); 339*83ef0d71SAndreas Gohr 340*83ef0d71SAndreas Gohr $core = new DokuWikiFarmCore(); 341*83ef0d71SAndreas Gohr $urlparts = parse_url($url); 342*83ef0d71SAndreas Gohr $core->injectServerEnvironment($urlparts); 343*83ef0d71SAndreas Gohr 344*83ef0d71SAndreas Gohr $base_dir = getBaseURL(false); 345*83ef0d71SAndreas Gohr $base_url = getBaseURL(true); 346*83ef0d71SAndreas Gohr 347*83ef0d71SAndreas Gohr // first check that the directory was detected correctly… 348*83ef0d71SAndreas Gohr $this->assertEquals($expected_basedir, $base_dir, 'Base directory does not match expected value'); 349*83ef0d71SAndreas Gohr // …then check that the expected base URL plus the directory matches the absolute URL 350*83ef0d71SAndreas Gohr $this->assertEquals($expected_baseurl . $base_dir, $base_url, 'Absolute URL does not match expected value'); 351*83ef0d71SAndreas Gohr 352*83ef0d71SAndreas Gohr 353*83ef0d71SAndreas Gohr } 35485becf1bSAndreas Gohr} 355