Exemplo n.º 1
0
 public function testUsingLinuxDirectorySeparator()
 {
     test::double('mrv\\Autoloader\\Common', ['getSeparator' => '/']);
     $desiredPath = '/path/to/some/namespace/file.php';
     $this->assertEquals($desiredPath, Common::convertPathAccordingSO('\\path\\to\\some\\namespace\\file.php'));
     $this->assertEquals($desiredPath, Common::convertPathAccordingSO('\\path\\to\\some\\namespace\\file.php'));
     $this->assertEquals($desiredPath, Common::convertPathAccordingSO('/path/to\\some/namespace\\file.php'));
     $this->assertEquals($desiredPath, Common::convertPathAccordingSO('/path/to/some/namespace/file.php'));
 }
 public function testLoadFromRelativeNamespace()
 {
     $common = test::double('mrv\\Autoloader\\Common');
     //only one candidate
     $this->nlr->loadFromNamespaces('\\Namespace2\\security\\Auth');
     $common->verifyInvoked('tryRequire', [Common::convertPathAccordingSO('\\var\\lib') . '\\security\\Auth.php']);
     //2 possible candidates
     $this->nlr->loadFromNamespaces('\\Namespace2\\core\\services\\Mailer');
     $common->verifyInvoked('tryRequire', [Common::convertPathAccordingSO('\\var\\lib') . '\\core\\services\\Mailer.php']);
     $common->verifyInvoked('tryRequire', [Common::convertPathAccordingSO('\\srv\\local\\lib') . '\\services\\Mailer.php']);
     //Not called with other namespaces
     $common->verifyInvokedMultipleTimes('tryRequire', 3);
 }