diff --git a/CHANGELOG.md b/CHANGELOG.md index 23228679..5a5ba595 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to this project will be documented in this file. This project adhere to the [Semantic Versioning](http://semver.org/) standard. +## [0.0.3] 2025-07-31 + +* Fix - Removed an empty line after the columns and before the primary key of the Table creation SQL. + +[0.0.3]: https://github.com/stellarwp/shepherd/releases/tag/0.0.3 + ## [0.0.2] 2025-07-14 * Fix - Fix the path to the Action Scheduler file to take into consideration the different ways Composer can be installed. diff --git a/shepherd.php b/shepherd.php index ff3658f2..c7446792 100644 --- a/shepherd.php +++ b/shepherd.php @@ -9,7 +9,7 @@ * @wordpress-plugin * Plugin Name: Shepherd * Description: A library for offloading tasks to background processes. - * Version: 0.0.2 + * Version: 0.0.3 * Author: StellarWP * Author URI: https://stellarwp.com * License: GPL-2.0-or-later diff --git a/src/Abstracts/Table_Abstract.php b/src/Abstracts/Table_Abstract.php index c81e4436..39a48f48 100644 --- a/src/Abstracts/Table_Abstract.php +++ b/src/Abstracts/Table_Abstract.php @@ -227,6 +227,7 @@ protected function check_and_add_index( array $results, string $index_name, stri * by the `dbDelta` function. * * @since 0.0.1 + * @since 0.0.3 Updated to remove an empty line after the columns and before the primary key. * * @return string The table creation SQL, in the format supported * by the `dbDelta` function. @@ -264,11 +265,11 @@ public function get_definition() { $columns_definitions[] = $column_sql; } - $columns_sql = implode( ',' . PHP_EOL, $columns_definitions ) . ',' . PHP_EOL; + $columns_sql = implode( ',' . PHP_EOL, $columns_definitions ); return " CREATE TABLE `{$table_name}` ( - {$columns_sql} + {$columns_sql}, PRIMARY KEY (`{$uid_column}`) ) {$charset_collate}; "; diff --git a/src/Tables/Task_Logs.php b/src/Tables/Task_Logs.php index 0f4e743b..8c109c5f 100644 --- a/src/Tables/Task_Logs.php +++ b/src/Tables/Task_Logs.php @@ -52,10 +52,11 @@ class Task_Logs extends Table { * The schema version. * * @since 0.0.1 + * @since 0.0.3 Updated to 0.0.3. * * @var string */ - const SCHEMA_VERSION = '0.0.2-dev'; + const SCHEMA_VERSION = '0.0.3'; /** * The base table name, without the table prefix. diff --git a/src/Tables/Tasks.php b/src/Tables/Tasks.php index 69a71c6e..e40e2aca 100644 --- a/src/Tables/Tasks.php +++ b/src/Tables/Tasks.php @@ -47,10 +47,11 @@ class Tasks extends Table { * The schema version. * * @since 0.0.1 + * @since 0.0.3 Updated to 0.0.2. * * @var string */ - const SCHEMA_VERSION = '0.0.1-dev'; + const SCHEMA_VERSION = '0.0.2s'; /** * The base table name, without the table prefix. diff --git a/tests/integration/Herding_Test.php b/tests/integration/Herding_Test.php index f41a3178..77648dde 100644 --- a/tests/integration/Herding_Test.php +++ b/tests/integration/Herding_Test.php @@ -268,15 +268,15 @@ public function it_should_only_clean_orphaned_tasks_not_active_ones(): void { $shepherd->dispatch( $task1 ); $task_id_1 = $shepherd->get_last_scheduled_task_id(); + // Execute first task + $this->assertTaskExecutesWithoutErrors( $task_id_1 ); + $task2 = new Do_Action_Task( 'arg2' ); $shepherd->dispatch( $task2 ); $task_id_2 = $shepherd->get_last_scheduled_task_id(); $this->assertNotEquals( $task_id_1, $task_id_2 ); - // Execute first task - $this->assertTaskExecutesWithoutErrors( $task_id_1 ); - // Manually remove only the first task's action from Action Scheduler DB::query( DB::prepare( diff --git a/tests/integration/Provider_Test.php b/tests/integration/Provider_Test.php index d5d3e0a5..5c1cf5e4 100644 --- a/tests/integration/Provider_Test.php +++ b/tests/integration/Provider_Test.php @@ -102,7 +102,6 @@ public function it_should_delete_multiple_tasks_for_same_action(): void { $task_id_2 = $shepherd->get_last_scheduled_task_id(); $this->assertTaskExecutesWithoutErrors( $task_id_1 ); - $this->assertTaskExecutesWithoutErrors( $task_id_2 ); // Manually set both tasks to have the same action_id for testing. $common_action_id = $task1->get_action_id(); @@ -126,6 +125,7 @@ public function it_should_delete_multiple_tasks_for_same_action(): void { $task_id_2 ) ); + $this->assertEquals( 2, $tasks_count_before ); $this->delete_tasks_action( $task1 ); @@ -177,11 +177,12 @@ public function it_should_only_delete_tasks_for_specified_action(): void { $shepherd->dispatch( $task1 ); $task_id_1 = $shepherd->get_last_scheduled_task_id(); + $this->assertTaskExecutesWithoutErrors( $task_id_1 ); + $task2 = new Do_Action_Task( 'arg2' ); $shepherd->dispatch( $task2 ); $task_id_2 = $shepherd->get_last_scheduled_task_id(); - $this->assertTaskExecutesWithoutErrors( $task_id_1 ); $this->assertTaskExecutesWithoutErrors( $task_id_2 ); $this->delete_tasks_action( $task1 ); diff --git a/tests/integration/Tasks/Email_Test.php b/tests/integration/Tasks/Email_Test.php index 95a22450..53f9075a 100644 --- a/tests/integration/Tasks/Email_Test.php +++ b/tests/integration/Tasks/Email_Test.php @@ -233,19 +233,17 @@ public function it_should_schedule_multiple_tasks_with_different_args(): void { $task1_id = $shepherd->get_last_scheduled_task_id(); $this->assertIsInt( $task1_id ); + $this->assertTaskExecutesWithoutErrors( $task1_id ); + $task2 = new Email( 'test2@test.com', 'subject2', 'body2' ); $shepherd->dispatch( $task2 ); $task2_id = $shepherd->get_last_scheduled_task_id(); $this->assertIsInt( $task2_id ); - $this->assertNotEquals( $task1_id, $task2_id ); - - $hook_name = 'shepherd_' . tests_shepherd_get_hook_prefix() . '_task_already_scheduled'; - $this->assertSame( 0, did_action( $hook_name ) ); - - $this->assertTaskExecutesWithoutErrors( $task1_id ); $this->assertTaskExecutesWithoutErrors( $task2_id ); + $this->assertNotEquals( $task1_id, $task2_id ); + $this->assertCount( 2, $spy ); $this->assertSame( [ 'test1@test.com', 'subject1', 'body1', [], [] ], $spy[0] ); $this->assertSame( [ 'test2@test.com', 'subject2', 'body2', [], [] ], $spy[1] ); diff --git a/tests/integration/Tasks/HTTP_Request_Test.php b/tests/integration/Tasks/HTTP_Request_Test.php index 7c0c39d5..c0e57045 100644 --- a/tests/integration/Tasks/HTTP_Request_Test.php +++ b/tests/integration/Tasks/HTTP_Request_Test.php @@ -382,19 +382,17 @@ public function it_should_schedule_different_requests_separately(): void { $task1_id = $shepherd->get_last_scheduled_task_id(); $this->assertIsInt( $task1_id ); + $this->assertTaskExecutesWithoutErrors( $task1_id ); + $task2 = new HTTP_Request( 'https://api2.example.com/endpoint' ); $shepherd->dispatch( $task2 ); $task2_id = $shepherd->get_last_scheduled_task_id(); $this->assertIsInt( $task2_id ); - $this->assertNotEquals( $task1_id, $task2_id ); - - $hook_name = 'shepherd_' . tests_shepherd_get_hook_prefix() . '_task_already_scheduled'; - $this->assertSame( 0, did_action( $hook_name ) ); - - $this->assertTaskExecutesWithoutErrors( $task1_id ); $this->assertTaskExecutesWithoutErrors( $task2_id ); + $this->assertNotEquals( $task1_id, $task2_id ); + $this->assertCount( 2, $spy ); $this->assertEquals( 'https://api1.example.com/endpoint', $spy[0][0] ); $this->assertEquals( 'https://api2.example.com/endpoint', $spy[1][0] );