Skip to content

Commit

Permalink
Fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MlKilderkin committed Aug 11, 2023
1 parent 9f1ea5d commit ba89e79
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 215 deletions.
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
"codeception/util-universalframework": "^1.0",
"lucatume/di52": "^3.0",
"lucatume/wp-browser": "^3.0.14",
"php-mock/php-mock-phpunit": "^2.7",
"phpunit/phpunit": "~6.0",
"symfony/event-dispatcher-contracts": "^2.5.1",
"symfony/string": "^5.4",
Expand Down
209 changes: 1 addition & 208 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 11 additions & 6 deletions tests/wpunit/API/Validation_ResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@

namespace wpunit\API;

use phpmock\phpunit\PHPMock;
use StellarWP\Uplink\API\Validation_Response;
use StellarWP\Uplink\Register;
use StellarWP\Uplink\Resources\Plugin;
use StellarWP\Uplink\Resources\Resource;
use StellarWP\Uplink\Tests\UplinkTestCase;
use StellarWP\Uplink\Uplink;

class Validation_ResponseTest extends UplinkTestCase {

use PHPMock;

public $resource;

public function setUp() {
Expand All @@ -36,9 +35,15 @@ public function get_dummy_api_invalid_response(): \stdClass {
}

public function test_it_should_provide_valid_update_details(): void {
$exec = $this->getFunctionMock(__NAMESPACE__, "get_plugin_data");
$exec->expects($this->once())->with()->willReturn("1.0.10");
$result = new Validation_Response( 'aaa11', 'local', $this->get_dummy_valid_response(), $this->resource );
$resource = $this->getMockBuilder( Plugin::class )->setConstructorArgs( [ 'sample',
'Lib Sample',
'1.0.10',
'uplink/plugin.php',
Uplink::class,
Uplink::class
] )->getMock();
$resource->method('get_installed_version')->willReturn( '1.0.10' );
$result = new Validation_Response( 'aaa11', 'local', $this->get_dummy_valid_response(), $resource );
$update = $result->get_update_details();

$this->assertEquals( '', $update->id );
Expand Down

0 comments on commit ba89e79

Please sign in to comment.