Skip to content

Commit e6ef1cc

Browse files
authored
add tests
1 parent 9eac667 commit e6ef1cc

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/unit/Codeception/Module/RestTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,28 @@ public function testAmDigestAuthenticatedThrowsExceptionWithFunctionalModules()
442442
$this->module->amDigestAuthenticated('username', 'password');
443443
}
444444

445+
public function testCanResetHTTPAuthenticated()
446+
{
447+
$this->module->amHttpAuthenticated('user', 'pass');
448+
$this->module->sendGET('/rest/user/');
449+
$server = $this->module->client->getRequest()->getServer();
450+
$this->assertArrayHasKey('PHP_AUTH_USER', $server);
451+
$this->assertArrayHasKey('PHP_AUTH_PW', $server);
452+
$this->module->setServerParameters([]);
453+
$this->module->sendGET('/rest/user/');
454+
$server = $this->module->client->getRequest()->getServer();
455+
$this->assertArrayNotHasKey('PHP_AUTH_USER', $server);
456+
$this->assertArrayNotHasKey('PHP_AUTH_PW', $server);
457+
}
458+
459+
public function testHaveServerParameter()
460+
{
461+
$this->module->haveServerParameter('my', 'param');
462+
$this->module->sendGET('/rest/user/');
463+
$server = $this->module->client->getRequest()->getServer();
464+
$this->assertArrayHasKey('my', $server);
465+
}
466+
445467
/**
446468
* @param $configUrl
447469
* @param $requestUrl

0 commit comments

Comments
 (0)