Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JPush: Update to latest Lunr.Halo #30

Merged
merged 1 commit into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*
* @covers \Lunr\Vortex\JPush\JPushBatchResponse
*/
class JPushBatchResponseBasePushErrorTest extends JPushBatchResponseTest
class JPushBatchResponseBasePushErrorTest extends JPushBatchResponseTestCase
{

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*
* @covers \Lunr\Vortex\JPush\JPushBatchResponse
*/
class JPushBatchResponseBasePushSuccessTest extends JPushBatchResponseTest
class JPushBatchResponseBasePushSuccessTest extends JPushBatchResponseTestCase
{

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* @covers \Lunr\Vortex\JPush\JPushBatchResponse
*/
class JPushBatchResponseGetMessageIdTest extends JPushBatchResponseTest
class JPushBatchResponseGetMessageIdTest extends JPushBatchResponseTestCase
{

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
* @covers \Lunr\Vortex\JPush\JPushBatchResponse
*/
class JPushBatchResponseGetStatusTest extends JPushBatchResponseTest
class JPushBatchResponseGetStatusTest extends JPushBatchResponseTestCase
{

/**
Expand Down Expand Up @@ -82,8 +82,8 @@ public function endpointDataProvider(): array
*/
public function testGetStatus($statuses, $status): void
{
$this->set_reflection_property_value('statuses', $statuses);
$this->set_reflection_property_value('message_id', 1453658564165);
$this->setReflectionPropertyValue('statuses', $statuses);
$this->setReflectionPropertyValue('message_id', 1453658564165);

$result = $this->class->get_status('endpoint_param');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* This file contains the JPushBatchResponseTest class.
* This file contains the JPushBatchResponseTestCase class.
*
* SPDX-FileCopyrightText: Copyright 2020 M2mobi B.V., Amsterdam, The Netherlands
* SPDX-FileCopyrightText: Copyright 2022 Move Agency Group B.V., Zwolle, The Netherlands
Expand All @@ -10,7 +10,7 @@

namespace Lunr\Vortex\JPush\Tests;

use Lunr\Halo\LunrBaseTest;
use Lunr\Halo\LunrBaseTestCase;
use Lunr\Vortex\JPush\JPushBatchResponse;
use PHPUnit\Framework\MockObject\MockObject;
use WpOrg\Requests\Response;
Expand All @@ -22,7 +22,7 @@
*
* @covers \Lunr\Vortex\JPush\JPushBatchResponse
*/
abstract class JPushBatchResponseTest extends LunrBaseTest
abstract class JPushBatchResponseTestCase extends LunrBaseTestCase
{

/**
Expand Down
6 changes: 3 additions & 3 deletions src/Lunr/Vortex/JPush/Tests/JPushDispatcherBaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*
* @covers \Lunr\Vortex\JPush\JPushDispatcher
*/
class JPushDispatcherBaseTest extends JPushDispatcherTest
class JPushDispatcherBaseTest extends JPushDispatcherTestCase
{

use PsrLoggerTestTrait;
Expand Down Expand Up @@ -45,7 +45,7 @@ public function testAuthTokenIsEmptyString(): void
*/
public function testGetNewResponseObjectForFailedRequest(): void
{
$method = $this->get_accessible_reflection_method('get_new_response_object_for_failed_request');
$method = $this->getReflectionMethod('get_new_response_object_for_failed_request');

$result = $method->invoke($this->class);

Expand All @@ -72,7 +72,7 @@ public function testGetResponseReturnsJPushResponseObject(): void
*/
public function testGetBatchResponseReturnsJPushBatchResponseObject(): void
{
$method = $this->get_accessible_reflection_method('get_batch_response');
$method = $this->getReflectionMethod('get_batch_response');
$result = $method->invokeArgs($this->class, [ $this->response, [ 'endpoint' ], '[]' ]);

$this->assertInstanceOf('Lunr\Vortex\JPush\JPushBatchResponse', $result);
Expand Down
22 changes: 11 additions & 11 deletions src/Lunr/Vortex/JPush/Tests/JPushDispatcherPushTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*
* @covers \Lunr\Vortex\JPush\JPushDispatcher
*/
class JPushDispatcherPushTest extends JPushDispatcherTest
class JPushDispatcherPushTest extends JPushDispatcherTestCase
{

/**
Expand Down Expand Up @@ -90,7 +90,7 @@ public function testPushBatchReturnsJPushBatchResponseObject(): void
->method('post')
->will($this->returnValue($response));

$method = $this->get_accessible_reflection_method('push_batch');
$method = $this->getReflectionMethod('push_batch');
$result = $method->invokeArgs($this->class, [ $this->payload, &$endpoints ]);

$this->assertInstanceOf('Lunr\Vortex\JPush\JPushBatchResponse', $result);
Expand Down Expand Up @@ -124,7 +124,7 @@ public function testPushResetsProperties(): void
->method('get_payload')
->willReturn([ 'collapse_key' => 'abcde-12345' ]);

$this->set_reflection_property_value('auth_token', 'auth_token');
$this->setReflectionPropertyValue('auth_token', 'auth_token');

$response = $this->getMockBuilder('WpOrg\Requests\Response')->getMock();

Expand All @@ -144,7 +144,7 @@ public function testPushResetsProperties(): void
*/
public function testPushWithFailedRequest(): void
{
$this->mock_function('curl_errno', function () { return 10; });
$this->mockFunction('curl_errno', function () { return 10; });

$endpoints = [ 'endpoint' ];
$url = 'https://api.jpush.cn/v3/push';
Expand Down Expand Up @@ -172,7 +172,7 @@ public function testPushWithFailedRequest(): void

$this->assertInstanceOf('Lunr\Vortex\JPush\JPushResponse', $result);

$this->unmock_function('curl_errno');
$this->unmockFunction('curl_errno');
}

/**
Expand All @@ -182,7 +182,7 @@ public function testPushWithFailedRequest(): void
*/
public function testPushWithTimeoutRequest()
{
$this->mock_function('curl_errno', function () { return 28; });
$this->mockFunction('curl_errno', function () { return 28; });

$endpoints = [ 'endpoint' ];
$url = 'https://api.jpush.cn/v3/push';
Expand Down Expand Up @@ -212,7 +212,7 @@ public function testPushWithTimeoutRequest()

$this->assertSame($result->get_status('endpoint'), PushNotificationStatus::TemporaryError);

$this->unmock_function('curl_errno');
$this->unmockFunction('curl_errno');
}

/**
Expand Down Expand Up @@ -299,7 +299,7 @@ public function testPushRequestWithSingleEndpoint(): void
->method('get_payload')
->willReturn($payload);

$this->set_reflection_property_value('auth_token', 'auth_token');
$this->setReflectionPropertyValue('auth_token', 'auth_token');

$response = $this->getMockBuilder('WpOrg\Requests\Response')->getMock();

Expand Down Expand Up @@ -328,7 +328,7 @@ public function testPushRequestWithMultibyteCharacters(): void
->method('get_payload')
->willReturn($payload);

$this->set_reflection_property_value('auth_token', 'auth_token');
$this->setReflectionPropertyValue('auth_token', 'auth_token');

$response = $this->getMockBuilder('WpOrg\Requests\Response')->getMock();

Expand Down Expand Up @@ -356,7 +356,7 @@ public function testPushRequestWithMultipleEndpointsOneBatch(): void
->method('get_payload')
->willReturn($payload);

$this->set_reflection_property_value('auth_token', 'auth_token');
$this->setReflectionPropertyValue('auth_token', 'auth_token');

$response = $this->getMockBuilder('WpOrg\Requests\Response')->getMock();

Expand All @@ -382,7 +382,7 @@ public function testPushRequestWithMultipleEndpointsMultipleBatches(): void
{
$endpoints = [ 'endpoint1', 'endpoint2', 'endpoint3', 'endpoint4', 'endpoint5' ];

$this->set_reflection_property_value('auth_token', 'auth_token');
$this->setReflectionPropertyValue('auth_token', 'auth_token');

$response = $this->getMockBuilder('WpOrg\Requests\Response')->getMock();

Expand Down
2 changes: 1 addition & 1 deletion src/Lunr/Vortex/JPush/Tests/JPushDispatcherSetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
* @covers \Lunr\Vortex\JPush\JPushDispatcher
*/
class JPushDispatcherSetTest extends JPushDispatcherTest
class JPushDispatcherSetTest extends JPushDispatcherTestCase
{

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* This file contains the JPushDispatcherTest class.
* This file contains the JPushDispatcherTestCase class.
*
* SPDX-FileCopyrightText: Copyright 2020 M2mobi B.V., Amsterdam, The Netherlands
* SPDX-FileCopyrightText: Copyright 2022 Move Agency Group B.V., Zwolle, The Netherlands
Expand All @@ -10,7 +10,7 @@

namespace Lunr\Vortex\JPush\Tests;

use Lunr\Halo\LunrBaseTest;
use Lunr\Halo\LunrBaseTestCase;
use Lunr\Vortex\JPush\JPushDispatcher;
use Lunr\Vortex\JPush\JPushPayload;
use Psr\Log\LoggerInterface;
Expand All @@ -23,7 +23,7 @@
*
* @covers \Lunr\Vortex\JPush\JPushDispatcher
*/
abstract class JPushDispatcherTest extends LunrBaseTest
abstract class JPushDispatcherTestCase extends LunrBaseTestCase
{
/**
* Mock instance of the Requests\Session class.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
* @covers \Lunr\Vortex\JPush\JPushMessagePayload
*/
class JPushMessagePayloadBaseTest extends JPushMessagePayloadTest
class JPushMessagePayloadBaseTest extends JPushMessagePayloadTestCase
{

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Lunr/Vortex/JPush/Tests/JPushMessagePayloadGetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
* @covers \Lunr\Vortex\JPush\JPushMessagePayload
*/
class JPushMessagePayloadGetTest extends JPushMessagePayloadTest
class JPushMessagePayloadGetTest extends JPushMessagePayloadTestCase
{

/**
Expand Down Expand Up @@ -51,7 +51,7 @@ public function testGetPayloadMessage(): void
'time_to_live' => 10,
];

$this->set_reflection_property_value('elements', $elements);
$this->setReflectionPropertyValue('elements', $elements);

$this->assertEquals($expected, $this->class->get_payload());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* This file contains the JPushMessagePayloadTest class.
* This file contains the JPushMessagePayloadTestCase class.
*
* SPDX-FileCopyrightText: Copyright 2020 M2mobi B.V., Amsterdam, The Netherlands
* SPDX-FileCopyrightText: Copyright 2022 Move Agency Group B.V., Zwolle, The Netherlands
Expand All @@ -10,7 +10,7 @@

namespace Lunr\Vortex\JPush\Tests;

use Lunr\Halo\LunrBaseTest;
use Lunr\Halo\LunrBaseTestCase;
use Lunr\Vortex\JPush\JPushMessagePayload;

/**
Expand All @@ -19,7 +19,7 @@
*
* @covers Lunr\Vortex\JPush\JPushMessagePayload
*/
abstract class JPushMessagePayloadTest extends LunrBaseTest
abstract class JPushMessagePayloadTestCase extends LunrBaseTestCase
{

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
* @covers \Lunr\Vortex\JPush\JPushNotification3rdPayload
*/
class JPushNotification3rdPayloadBaseTest extends JPushNotification3rdPayloadTest
class JPushNotification3rdPayloadBaseTest extends JPushNotification3rdPayloadTestCase
{

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
* @covers \Lunr\Vortex\JPush\JPushNotification3rdPayload
*/
class JPushNotification3rdPayloadGetTest extends JPushNotification3rdPayloadTest
class JPushNotification3rdPayloadGetTest extends JPushNotification3rdPayloadTestCase
{

/**
Expand Down Expand Up @@ -53,7 +53,7 @@ public function testGetPayloadMessage(): void
'time_to_live' => 10,
];

$this->set_reflection_property_value('elements', $elements);
$this->setReflectionPropertyValue('elements', $elements);

$this->assertEquals($expected, $this->class->get_payload());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
* @covers \Lunr\Vortex\JPush\JPushNotification3rdPayload
*/
class JPushNotification3rdPayloadSetTest extends JPushNotification3rdPayloadTest
class JPushNotification3rdPayloadSetTest extends JPushNotification3rdPayloadTestCase
{

/**
Expand All @@ -26,7 +26,7 @@ public function testSetSound(): void
{
$this->class->set_sound('sound');

$value = $this->get_reflection_property_value('elements');
$value = $this->getReflectionPropertyValue('elements');

$this->assertArrayHasKey('sound', $value['notification_3rd']);
$this->assertEquals('sound', $value['notification_3rd']['sound']);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?php

/**
* This file contains the JPushNotification3rdPayloadTest class.
* This file contains the JPushNotification3rdPayloadTestCase class.
*
* SPDX-FileCopyrightText: Copyright 2022 Move Agency Group B.V., Zwolle, The Netherlands
* SPDX-License-Identifier: MIT
*/

namespace Lunr\Vortex\JPush\Tests;

use Lunr\Halo\LunrBaseTest;
use Lunr\Halo\LunrBaseTestCase;
use Lunr\Vortex\JPush\JPushNotification3rdPayload;

/**
Expand All @@ -18,7 +18,7 @@
*
* @covers Lunr\Vortex\JPush\JPushNotification3rdPayload
*/
abstract class JPushNotification3rdPayloadTest extends LunrBaseTest
abstract class JPushNotification3rdPayloadTestCase extends LunrBaseTestCase
{

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
* @covers \Lunr\Vortex\JPush\JPushNotificationPayload
*/
class JPushNotificationPayloadBaseTest extends JPushNotificationPayloadTest
class JPushNotificationPayloadBaseTest extends JPushNotificationPayloadTestCase
{

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
* @covers \Lunr\Vortex\JPush\JPushNotificationPayload
*/
class JPushNotificationPayloadGetTest extends JPushNotificationPayloadTest
class JPushNotificationPayloadGetTest extends JPushNotificationPayloadTestCase
{

/**
Expand Down Expand Up @@ -56,7 +56,7 @@ public function testGetPayloadNotification(): void
'time_to_live' => 10,
];

$this->set_reflection_property_value('elements', $elements);
$this->setReflectionPropertyValue('elements', $elements);

$this->assertEquals($expected, $this->class->get_payload());
}
Expand Down
Loading
Loading