Skip to content

Commit

Permalink
Add more descriptive failure message in `CompleteSetupTaskTest::setUp…
Browse files Browse the repository at this point in the history
…` in case the task is not found.

Addresses woocommerce#2026 (review)
  • Loading branch information
tomalec authored and matt-h committed Aug 8, 2023
1 parent e20e37d commit de9f2be
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/Unit/TaskList/CompleteSetupTaskTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ public function setUp(): void {

// Fetch the task from the global list.
$this->task = TaskLists::get_list( 'extended' )->get_task( 'gla_complete_setup' );
if ( ! $this->task ) {
$this->fail( '`gla_complete_setup` task not found in the extended list.' );
}
$this->task->set_merchant_center_object( $this->merchant_center );
}

Expand All @@ -44,7 +47,6 @@ public function setUp(): void {
* So, we do not precisely assert timing and exact instance, only the presence of a task.
*/
public function test_register() {
$this->assertNotNull( TaskLists::get_list( 'extended' )->get_task( 'gla_complete_setup' ) );
$this->assertInstanceOf( CompleteSetupTask::class, TaskLists::get_list( 'extended' )->get_task( 'gla_complete_setup' ) );

}
Expand Down

0 comments on commit de9f2be

Please sign in to comment.