These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace AdvancedLearning\Oauth2Server\Tests; |
||
4 | |||
5 | use AdvancedLearning\Oauth2Server\Extensions\GroupExtension; |
||
6 | use AdvancedLearning\Oauth2Server\Services\ScopeService; |
||
7 | use SilverStripe\Core\Config\Config; |
||
8 | use SilverStripe\Dev\SapphireTest; |
||
9 | use SilverStripe\Security\Group; |
||
10 | use SilverStripe\Security\Member; |
||
11 | |||
12 | class ScopeTest extends SapphireTest |
||
13 | { |
||
14 | protected static $fixture_file = './OauthFixture.yml'; |
||
15 | |||
16 | /** |
||
17 | * Setup test environment. |
||
18 | */ |
||
19 | public function setUp() |
||
20 | { |
||
21 | // add GroupExtension for scopes |
||
22 | Config::forClass(Group::class)->merge('extensions', [GroupExtension::class]); |
||
23 | |||
24 | parent::setUp(); |
||
25 | } |
||
26 | |||
27 | View Code Duplication | public function testHasScope() |
|
28 | { |
||
29 | $service = new ScopeService(); |
||
30 | $member = $this->objFromFixture(Member::class, 'member1'); |
||
31 | |||
32 | $this->assertTrue($service->hasScope('scope1', $member, 'Member should have scope1')); |
||
0 ignored issues
–
show
|
|||
33 | $this->assertFalse($service->hasScope('scope2', $member, 'Member should have scope2')); |
||
0 ignored issues
–
show
The call to
ScopeService::hasScope() has too many arguments starting with 'Member should have scope2' .
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue. If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. In this case you can add the
Loading history...
|
|||
34 | } |
||
35 | } |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.