Skip to content

Commit

Permalink
PHPCS
Browse files Browse the repository at this point in the history
  • Loading branch information
puntope committed Nov 18, 2024
1 parent a4e8e22 commit b23eefd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class AttributeInputCollectionTest extends UnitTest {
*/
public function setUp(): void {
parent::setUp();
$this->options = $this->createMock( OptionsInterface::class );
$this->options = $this->createMock( OptionsInterface::class );
}

public function test_adult_input() {
Expand Down
14 changes: 5 additions & 9 deletions tests/Unit/Jobs/MigrateGTINTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function setUp(): void {
parent::setUp();

$this->action_scheduler = $this->createMock( ActionScheduler::class );
$this->options = $this->createMock( OptionsInterface::class );
$this->options = $this->createMock( OptionsInterface::class );
$this->monitor = $this->createMock( ActionSchedulerJobMonitor::class );
$this->product_repository = $this->createMock( ProductRepository::class );
$this->attribute_manager = $this->createMock( AttributeManager::class );
Expand Down Expand Up @@ -87,14 +87,14 @@ public function test_job_name() {
public function test_schedule_updates_status_to_started() {
$this->options->expects( $this->exactly( 1 ) )
->method( 'update' )
->with( OptionsInterface::GTIN_MIGRATION_STATUS, MigrateGTIN::GTIN_MIGRATION_STARTED );
->with( OptionsInterface::GTIN_MIGRATION_STATUS, MigrateGTIN::GTIN_MIGRATION_STARTED );
$this->job->schedule();
}

public function test_completed_job_updates_status_to_completed() {
$this->options->expects( $this->exactly( 1 ) )
->method( 'update' )
->with( OptionsInterface::GTIN_MIGRATION_STATUS, MigrateGTIN::GTIN_MIGRATION_COMPLETED );
->with( OptionsInterface::GTIN_MIGRATION_STATUS, MigrateGTIN::GTIN_MIGRATION_COMPLETED );
$this->job->handle_complete( 2 );
}

Expand All @@ -103,7 +103,6 @@ public function test_single_empty_batch() {
->method( 'find_all_product_ids' )
->willReturn( [] );


$this->action_scheduler->expects( $this->once() )
->method( 'has_scheduled_action' )->willReturn( false );

Expand All @@ -123,7 +122,6 @@ public function test_single_batch() {
->method( 'find_all_product_ids' )
->willReturn( $batch );


$this->action_scheduler->expects( $this->exactly( 3 ) )
->method( 'has_scheduled_action' )->willReturn( false );

Expand Down Expand Up @@ -176,7 +174,6 @@ public function test_process_item_is_called_by_hook() {
->method( 'find_by_ids' )
->with( [ 1 ] );


do_action( self::PROCESS_ITEM_HOOK, [ 1 ] );
}

Expand All @@ -186,15 +183,15 @@ public function test_process_items_sucessfully_updates_gtin() {
->expects( $this->once() )
->method( 'find_by_ids' )
->with( [ 1 ] )
->willReturn( [ $product ] );
->willReturn( [ $product ] );

$this->attribute_manager
->expects( $this->once() )
->method( 'get_value' )
->with( $product, 'gtin' )
->willReturn( '1234-5678' );

$this->assertEquals( $product->get_global_unique_id(), null );
$this->assertEquals( $product->get_global_unique_id(), null );
$this->job->handle_process_items_action( [ 1 ] );
$this->assertEquals( $product->get_global_unique_id(), '12345678' );
}
Expand Down Expand Up @@ -261,5 +258,4 @@ public function test_process_items_not_updates_gtin_if_not_a_number() {
$this->job->handle_process_items_action( [ 1 ] );
$this->assertEquals( $product->get_global_unique_id(), null );
}

}

0 comments on commit b23eefd

Please sign in to comment.