Skip to content

Commit 8d8d808

Browse files
committed
Standardized result key names
Changed steps_completed to steps_complete to standardize its word usage among the other keys.
1 parent 400bf7b commit 8d8d808

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ $progress = (new Progress(
4848
"total_steps" => 1
4949
"percentage_complete" => 100.0
5050
"percentage_incomplete" => 0.0
51-
"steps_completed" => 1
51+
"steps_complete" => 1
5252
"steps_incomplete" => 0
5353
"complete_step_names" => [
5454
0 => "Age"

src/Progress.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ protected function evaluate(): array
111111
'total_steps' => $this->countSteps(),
112112
'percentage_complete' => $this->percentageComplete(),
113113
'percentage_incomplete' => max(100 - $this->percentageComplete(), 0),
114-
'steps_completed' => $this->countStepsPassed(),
114+
'steps_complete' => $this->countStepsPassed(),
115115
'steps_incomplete' => $this->countSteps() - $this->countStepsPassed(),
116116
'complete_step_names' => $this->passedStepNames(),
117117
'incomplete_step_names' => $this->failedStepNames()

tests/ProgressTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function step_fails()
2525
public function progress_can_receive_single_step()
2626
{
2727
$result = new Progress((new Step(31, 'Age'))->integer());
28-
$this->assertEquals($result->get()['steps_completed'], 1);
28+
$this->assertEquals($result->get()['steps_complete'], 1);
2929
}
3030

3131
/** @test */
@@ -35,7 +35,7 @@ public function progress_can_receive_multiple_steps()
3535
(new Step(31, 'Age'))->integer(),
3636
(new Step('John Smith', 'Name'))->string()->notEmpty()
3737
);
38-
$this->assertEquals($result->get()['steps_completed'], 2);
38+
$this->assertEquals($result->get()['steps_complete'], 2);
3939
}
4040

4141
/** @test */
@@ -47,7 +47,7 @@ public function progress_can_receive_array_of_steps()
4747
(new Step(true, 'Premier Member'))->boolean(),
4848
];
4949
$result = new Progress($steps);
50-
$this->assertEquals($result->get()['steps_completed'], 3);
50+
$this->assertEquals($result->get()['steps_complete'], 3);
5151
}
5252

5353
/** @test */
@@ -82,7 +82,7 @@ public function can_retrieve_result_key_from_magic_property()
8282
$progress = new Progress($steps);
8383
$progress->get();
8484

85-
$this->assertEquals($progress->steps_completed, 3);
85+
$this->assertEquals($progress->steps_complete, 3);
8686
}
8787

8888
/** @test */
@@ -104,7 +104,7 @@ public function progress_outputs_json()
104104
(new Step(null, 'List Your First Item For Sale'))->notEmpty()->integer(),
105105
];
106106
$result = (new Progress($steps))->toJson();
107-
$json = '{"total_steps":5,"percentage_complete":60,"percentage_incomplete":40,"steps_completed":3,"steps_incomplete":2,"complete_step_names":["Age","Confirmed Email","Connect Your Facebook"],"incomplete_step_names":{"3":"Connect Your PayPal","4":"List Your First Item For Sale"}}';
107+
$json = '{"total_steps":5,"percentage_complete":60,"percentage_incomplete":40,"steps_complete":3,"steps_incomplete":2,"complete_step_names":["Age","Confirmed Email","Connect Your Facebook"],"incomplete_step_names":{"3":"Connect Your PayPal","4":"List Your First Item For Sale"}}';
108108

109109
$this->assertEquals($result, $json);
110110
}

0 commit comments

Comments
 (0)