Skip to content

Commit

Permalink
Use mockery
Browse files Browse the repository at this point in the history
  • Loading branch information
jeawhanlee committed Sep 30, 2024
1 parent aee1c50 commit 24e79bb
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
namespace Imagify\Tests\Unit\classes;

use Mockery;
use Brain\Monkey\Functions;
use Imagify\Tests\Unit\TestCase;
use Imagify\User\User;
Expand All @@ -18,19 +19,15 @@ class Test_PluginActionLinks extends TestCase {
public function setUp(): void {
parent::setUp();

$this->user = $this->createMock( User::class );
$reflection = new \ReflectionClass( $this->user );
$this->plan_id = $reflection->getProperty( 'plan_id' );
$this->plan_id->setAccessible( true );

$this->user = Mockery::mock( User::class );
$this->admin_subscriber = new AdminSubscriber( $this->user );
}

/**
* @dataProvider configTestData
*/
public function testShouldReturnAsExpected( $config, $expected ) {
$this->plan_id->setValue( $this->user, $config['plan_id'] );
$this->user->plan_id = $config['plan_id'];

Functions\when( 'imagify_get_external_url' )->justReturn( 'https://example.org' );
Functions\when( 'get_imagify_admin_url' )->justReturn( 'https://example.org' );
Expand Down

0 comments on commit 24e79bb

Please sign in to comment.