| Conditions | 1 |
| Paths | 1 |
| Total Lines | 25 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 18 | public function testPushSubscription() |
||
| 19 | { |
||
| 20 | $data = [ |
||
| 21 | "endpoint" => "https://fcm.googleapis.com/fcm/send/dOG8e0uSfnA:APA91bHpydJQ-3nE0tk....", |
||
| 22 | "expirationTime" => null, |
||
| 23 | "keys" => [ |
||
| 24 | "auth" => "w6_GuDO7Jf-qEKV...", |
||
| 25 | "p256dh" => "BK1xht_jA4BFaIpOFyfGCuMLbCtdY8G7v4uZ5jUzsLO_ZgAwI....", |
||
| 26 | ] |
||
| 27 | ]; |
||
| 28 | $sub = PushSubscription::createNew($data); |
||
| 29 | |||
| 30 | $this->assertInstanceOf(PushSubscription::class, $sub); |
||
| 31 | $this->assertEquals($data['endpoint'], $sub->Endpoint); |
||
| 32 | |||
| 33 | $payload = ['data' => 'demo']; |
||
| 34 | |||
| 35 | $pushSub = $sub->createSubscription($payload); |
||
|
|
|||
| 36 | $this->assertInstanceOf(Subscription::class, $pushSub); |
||
| 37 | |||
| 38 | $byEndpoint = PushSubscription::getByEndpoint($sub->Endpoint); |
||
| 39 | $this->assertEquals($byEndpoint->ID, $sub->ID); |
||
| 40 | |||
| 41 | PushSubscription::deleteEndpoint($sub->Endpoint); |
||
| 42 | $this->assertTrue(PushSubscription::get()->count() === 0); |
||
| 43 | } |
||
| 45 |
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. Please note the @ignore annotation hint above.