Passed
Pull Request — master (#5)
by Robbie
02:50 queued 32s
created

LDAPChangePasswordHandlerTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 13
rs 10
c 1
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A testReturnsLdapChangePasswordForm() 0 11 1
1
<?php
2
3
namespace SilverStripe\LDAP\Tests\Authenticators;
4
5
use SilverStripe\Control\HTTPRequest;
6
use SilverStripe\Control\Session;
7
use SilverStripe\Core\Injector\Injector;
8
use SilverStripe\Dev\SapphireTest;
9
use SIlverStripe\LDAP\Authenticators\LDAPAuthenticator;
10
use SIlverStripe\LDAP\Authenticators\LDAPChangePasswordHandler;
11
use SIlverStripe\LDAP\Forms\LDAPChangePasswordForm;
12
13
class LDAPChangePasswordHandlerTest extends SapphireTest
14
{
15
    public function testReturnsLdapChangePasswordForm()
16
    {
17
        $this->logOut();
18
19
        $request = (new HTTPRequest('GET', '/'))
20
            ->setSession(new Session([]));
21
22
        $handler = LDAPChangePasswordHandler::create('foo', new LDAPAuthenticator)
0 ignored issues
show
Bug introduced by
new SIlverStripe\LDAP\Au...ors\LDAPAuthenticator() of type SIlverStripe\LDAP\Authenticators\LDAPAuthenticator is incompatible with the type array expected by parameter $args of SilverStripe\View\ViewableData::create(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

22
        $handler = LDAPChangePasswordHandler::create('foo', /** @scrutinizer ignore-type */ new LDAPAuthenticator)
Loading history...
Bug introduced by
'foo' of type string is incompatible with the type array expected by parameter $args of SilverStripe\View\ViewableData::create(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

22
        $handler = LDAPChangePasswordHandler::create(/** @scrutinizer ignore-type */ 'foo', new LDAPAuthenticator)
Loading history...
23
            ->setRequest($request);
24
25
        $this->assertInstanceOf(LDAPChangePasswordForm::class, $handler->changePasswordForm());
26
    }
27
}
28