Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
d4a3d38
wip(#5): blueprint — Workflow can't set boolean field
Jul 10, 2026
92dea5e
wip(#5): iteration 1 — agent execution
Jul 10, 2026
cb7df43
fix(#5): Workflow can't set boolean field
Jul 10, 2026
c99bf48
wip(#5): blueprint — Workflow can't set boolean field
Jul 10, 2026
c704898
wip(#5): iteration 1 — agent execution
Jul 10, 2026
e0f3bbb
fix(#5): Workflow can't set boolean field
Jul 10, 2026
1aa2859
wip(#5): blueprint — Workflow can't set boolean field
Jul 10, 2026
ed742fe
wip(#5): iteration 1 — agent execution
Jul 10, 2026
480eaaa
fix(#5): Workflow can't set boolean field
Jul 10, 2026
2b3b4af
wip(#5): blueprint — Workflow can't set boolean field
Jul 10, 2026
147de25
wip(#5): iteration 1 — agent execution
Jul 10, 2026
066ff04
fix(#5): Workflow can't set boolean field
Jul 10, 2026
035f489
wip(#5): blueprint — Workflow can't set boolean field
Jul 10, 2026
d135c12
wip(#5): iteration 1 — agent execution
Jul 10, 2026
28dc8f9
wip(#5): blueprint — Workflow can't set boolean field
Jul 10, 2026
6bd9866
wip(#5): iteration 2 — agent execution
Jul 10, 2026
f96d590
wip(#5): iteration 3 — agent execution
Jul 10, 2026
edae00f
wip(#5): iteration 4 — agent execution
Jul 10, 2026
2b47b35
wip(#5): blueprint — Workflow can't set boolean field
Jul 10, 2026
7479ebb
wip(#5): iteration 5 — agent execution
Jul 10, 2026
cba2aca
wip(#5): blueprint — Workflow can't set boolean field
Jul 10, 2026
727b88f
wip(#5): iteration 1 — agent execution
Jul 10, 2026
796accd
wip(#5): blueprint — Workflow can't set boolean field
Jul 10, 2026
8bb3f86
wip(#5): iteration 2 — agent execution
Jul 10, 2026
075b45d
wip(#5): blueprint — Workflow can't set boolean field
Jul 10, 2026
aefffeb
wip(#5): iteration 4 — agent execution
Jul 10, 2026
6153d54
fix(#5): Workflow can't set boolean field
Jul 10, 2026
e8e4b6d
wip(#5): blueprint — Workflow can't set boolean field
Jul 10, 2026
1ff9cb9
wip(#5): iteration 1 — agent execution
Jul 10, 2026
c99e612
wip(#5): blueprint — Workflow can't set boolean field
Jul 10, 2026
0dfee85
wip(#5): iteration 2 — agent execution
Jul 10, 2026
643f2c9
wip(#5): iteration 3 — agent execution
Jul 10, 2026
f245485
fix(#5): Workflow can't set boolean field
Jul 10, 2026
1046d6b
wip(#5): iteration 1 — agent execution
Jul 14, 2026
65e37c2
wip(#5): iteration 1 — agent execution
Jul 14, 2026
029bda3
wip(#5): iteration 1 — agent execution
Jul 14, 2026
058b7f8
wip(#5): iteration 2 — agent execution
Jul 14, 2026
c8a2e81
wip(#5): iteration 1 — agent execution
Jul 14, 2026
17ccc4d
wip(#5): iteration 3 — agent execution
Jul 14, 2026
2355295
wip(#5): iteration 1 — agent execution
Jul 14, 2026
3310eab
wip(#5): iteration 1 — agent execution
Jul 14, 2026
1356e7d
wip(#5): iteration 4 — agent execution
Jul 14, 2026
d473a2c
cleanup agent mess of files
cairocoder01 Jul 15, 2026
457bbe3
chore(#5): drop unrelated formatting churn; align test base class
cairocoder01 Jul 15, 2026
a59d4b8
fix bad cleanup that removed a switch case
cairocoder01 Jul 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions dt-workflows/workflows-execution-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ private static function condition_equals( $field_type, $field, $value ): bool {
case 'number':
return strval( $field ) === strval( $value );
case 'boolean':
return boolval( $field ) === boolval( $value );
return (bool) filter_var( $field, FILTER_VALIDATE_BOOLEAN ) === (bool) filter_var( $value, FILTER_VALIDATE_BOOLEAN );
case 'date':
// $value to be of epoch timestamp int type
return isset( $field['timestamp'] ) && intval( $field['timestamp'] ) === intval( $value );
Expand All @@ -169,7 +169,7 @@ private static function condition_not_equals( $field_type, $field, $value ): boo
case 'number':
return strval( $field ) !== strval( $value );
case 'boolean':
return boolval( $field ) !== boolval( $value );
return (bool) filter_var( $field, FILTER_VALIDATE_BOOLEAN ) !== (bool) filter_var( $value, FILTER_VALIDATE_BOOLEAN );
case 'date':
return isset( $field['timestamp'] ) && intval( $field['timestamp'] ) !== intval( $value );
}
Expand Down Expand Up @@ -535,11 +535,13 @@ private static function action_update( $field_type, $field_id, $value ): array {
switch ( $field_type ) {
case 'text':
case 'number':
case 'boolean':
case 'key_select':
case 'user_select':
$updated[ $field_id ] = $value;
break;
case 'boolean':
$updated[ $field_id ] = (bool) filter_var( $value, FILTER_VALIDATE_BOOLEAN );
break;
case 'date': // $value to be of epoch timestamp int type
$updated[ $field_id ] = $value === 'current' ? time() : $value;
break;
Expand Down
39 changes: 39 additions & 0 deletions tests/dt-workflows/unit-test-boolean-update.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php
class Unit_Test_Boolean_Update extends WP_UnitTestCase {
public function test_action_update_boolean() {
$method = new ReflectionMethod( 'Disciple_Tools_Workflows_Execution_Handler', 'action_update' );
$method->setAccessible( true );

// Test "true"
$result = $method->invoke( null, 'boolean', 'field_id', 'true' );
$this->assertEquals( [ 'field_id' => true ], $result );

// Test "false"
$result = $method->invoke( null, 'boolean', 'field_id', 'false' );
$this->assertEquals( [ 'field_id' => false ], $result );
}

public function test_condition_equals_boolean() {
$method = new ReflectionMethod( 'Disciple_Tools_Workflows_Execution_Handler', 'condition_equals' );
$method->setAccessible( true );

// Test "true" equals "true"
$this->assertTrue( $method->invoke( null, 'boolean', 'true', 'true' ) );
// Test "false" equals "false"
$this->assertTrue( $method->invoke( null, 'boolean', 'false', 'false' ) );
// Test "true" equals "false"
$this->assertFalse( $method->invoke( null, 'boolean', 'true', 'false' ) );
}

public function test_condition_not_equals_boolean() {
$method = new ReflectionMethod( 'Disciple_Tools_Workflows_Execution_Handler', 'condition_not_equals' );
$method->setAccessible( true );

// Test "true" not equals "false"
$this->assertTrue( $method->invoke( null, 'boolean', 'true', 'false' ) );
// Test "true" not equals "true"
$this->assertFalse( $method->invoke( null, 'boolean', 'true', 'true' ) );
// Test "false" not equals "false"
$this->assertFalse( $method->invoke( null, 'boolean', 'false', 'false' ) );
}
}
Loading