Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdijen committed Aug 4, 2024
1 parent fe785b9 commit d238b90
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion tests/src/TestCase/AuthSource/Ldap/LdapBindTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function testBindSuccesful(): void
$connectionMock = $this->getMockBuilder(Ldap::class)->onlyMethods(
['bind'],
)->disableOriginalConstructor()->getMock();
$connectionMock->expects($this->once())->method('bind')->willReturn(true);
$connectionMock->expects($this->once())->method('bind');
$confTest = new TestCase\AuthSource\Ldap\Bind(
new TestData([
'authSourceData' => Configuration::loadFromArray($authSourceData),
Expand Down
12 changes: 6 additions & 6 deletions tests/src/TestCase/AuthSource/NegotiateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ public function testNegotiateSuccess(): void
$KRB5NegotiateAuthMock = $this->getMockBuilder(KRB5NegotiateAuth::class)->onlyMethods(
['doAuthentication', 'getAuthenticatedUser'],
)->disableOriginalConstructor()->getMock();
$KRB5NegotiateAuthMock->expects($this->any())->method('doAuthentication')->will($this->returnValue(true));
$KRB5NegotiateAuthMock->expects($this->any())->method('getAuthenticatedUser')->will(
$this->returnValue('[email protected]'),
);
$KRB5NegotiateAuthMock->expects($this->any())->method('doAuthentication')->willReturn(true);
$KRB5NegotiateAuthMock->expects($this->any())
->method('getAuthenticatedUser')
->willReturn('[email protected]');
$testData = new TestData([
'handle' => $KRB5NegotiateAuthMock,
]);
Expand All @@ -67,7 +67,7 @@ public function testNegotiateNoAuthorzation(): void
$KRB5NegotiateAuthMock = $this->getMockBuilder(KRB5NegotiateAuth::class)->onlyMethods(
['doAuthentication', 'getAuthenticatedUser'],
)->disableOriginalConstructor()->getMock();
$KRB5NegotiateAuthMock->expects($this->any())->method('doAuthentication')->will($this->returnValue(false));
$KRB5NegotiateAuthMock->expects($this->any())->method('doAuthentication')->willReturn(false);
$testData = new TestData([
'handle' => $KRB5NegotiateAuthMock,
]);
Expand All @@ -82,7 +82,7 @@ public function testNegotiateError(): void
$KRB5NegotiateAuthMock = $this->getMockBuilder(KRB5NegotiateAuth::class)->onlyMethods(
['doAuthentication', 'getAuthenticatedUser'],
)->disableOriginalConstructor()->getMock();
$KRB5NegotiateAuthMock->expects($this->any())->method('doAuthentication')->will($this->returnValue(false));
$KRB5NegotiateAuthMock->expects($this->any())->method('doAuthentication')->willReturn(false);
$testData = new TestData([
'handle' => $KRB5NegotiateAuthMock,
'authorization' => 'test',
Expand Down
2 changes: 1 addition & 1 deletion tests/src/TestCase/CertificatesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class TestCertificatesTest extends \PHPUnit\Framework\TestCase

public static function setUpBeforeClass(): void
{
self::$certdir = getcwd() . '/vendor/simplesamlphp/xml-security/tests/resources/certificates/';
self::$certdir = getcwd() . '/vendor/simplesamlphp/xml-security/resources/certificates/';
}

public function testCertExpired(): void
Expand Down
4 changes: 2 additions & 2 deletions tests/src/TestCase/Network/ConnectUriTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class TestConnectUriTest extends \PHPUnit\Framework\TestCase
public function testConnectUriOK(): void
{
$testData = new TestData([
'uri' => 'ssl://127.0.0.1:443',
'uri' => 'ssl://google.com:443',
'context' => stream_context_create([
"ssl" => [
"capture_peer_cert" => true,
Expand All @@ -35,7 +35,7 @@ public function testConnectUriOK(): void
public function testConnectUriFailed(): void
{
$testData = new TestData([
'uri' => 'ssl://127.0.0.1:442',
'uri' => 'ssl://google.com:442',
]);
$connectionTest = new TestCase\Network\ConnectUri($testData);
$testResult = $connectionTest->getTestResult();
Expand Down

0 comments on commit d238b90

Please sign in to comment.