From 0c532abfa18e20f7f716273d322f7ef7c9a8fe76 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Tue, 17 Feb 2026 19:52:20 +0300 Subject: [PATCH] Added tests for `EnabledProgressBar` --- .../to_assert_with_data_set___10000__.snap | 6 ++++ .../to_assert_with_data_set___1000__.snap | 6 ++++ .../to_assert_with_data_set___3__.snap | 6 ++++ .../to_console_with_data_set___10000__.snap | 16 ++++++++++ .../to_console_with_data_set___1000__.snap | 16 ++++++++++ .../to_console_with_data_set___3__.snap | 16 ++++++++++ .../to_data_with_data_set___10000__.snap | 6 ++++ .../to_data_with_data_set___1000__.snap | 6 ++++ .../to_data_with_data_set___3__.snap | 6 ++++ tests/Unit/Result/EnabledProgressBar.php | 30 +++++++++++++++++++ 10 files changed, 114 insertions(+) create mode 100644 tests/.pest/snapshots/Unit/Result/EnabledProgressBar/to_assert_with_data_set___10000__.snap create mode 100644 tests/.pest/snapshots/Unit/Result/EnabledProgressBar/to_assert_with_data_set___1000__.snap create mode 100644 tests/.pest/snapshots/Unit/Result/EnabledProgressBar/to_assert_with_data_set___3__.snap create mode 100644 tests/.pest/snapshots/Unit/Result/EnabledProgressBar/to_console_with_data_set___10000__.snap create mode 100644 tests/.pest/snapshots/Unit/Result/EnabledProgressBar/to_console_with_data_set___1000__.snap create mode 100644 tests/.pest/snapshots/Unit/Result/EnabledProgressBar/to_console_with_data_set___3__.snap create mode 100644 tests/.pest/snapshots/Unit/Result/EnabledProgressBar/to_data_with_data_set___10000__.snap create mode 100644 tests/.pest/snapshots/Unit/Result/EnabledProgressBar/to_data_with_data_set___1000__.snap create mode 100644 tests/.pest/snapshots/Unit/Result/EnabledProgressBar/to_data_with_data_set___3__.snap create mode 100644 tests/Unit/Result/EnabledProgressBar.php diff --git a/tests/.pest/snapshots/Unit/Result/EnabledProgressBar/to_assert_with_data_set___10000__.snap b/tests/.pest/snapshots/Unit/Result/EnabledProgressBar/to_assert_with_data_set___10000__.snap new file mode 100644 index 0000000..1f17a11 --- /dev/null +++ b/tests/.pest/snapshots/Unit/Result/EnabledProgressBar/to_assert_with_data_set___10000__.snap @@ -0,0 +1,6 @@ + + + 0/1 [░░░░░░░░░░░░░░░░░░░░░░░░░░░░] 0% 1/1 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100% + + + diff --git a/tests/.pest/snapshots/Unit/Result/EnabledProgressBar/to_assert_with_data_set___1000__.snap b/tests/.pest/snapshots/Unit/Result/EnabledProgressBar/to_assert_with_data_set___1000__.snap new file mode 100644 index 0000000..1f17a11 --- /dev/null +++ b/tests/.pest/snapshots/Unit/Result/EnabledProgressBar/to_assert_with_data_set___1000__.snap @@ -0,0 +1,6 @@ + + + 0/1 [░░░░░░░░░░░░░░░░░░░░░░░░░░░░] 0% 1/1 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100% + + + diff --git a/tests/.pest/snapshots/Unit/Result/EnabledProgressBar/to_assert_with_data_set___3__.snap b/tests/.pest/snapshots/Unit/Result/EnabledProgressBar/to_assert_with_data_set___3__.snap new file mode 100644 index 0000000..1f17a11 --- /dev/null +++ b/tests/.pest/snapshots/Unit/Result/EnabledProgressBar/to_assert_with_data_set___3__.snap @@ -0,0 +1,6 @@ + + + 0/1 [░░░░░░░░░░░░░░░░░░░░░░░░░░░░] 0% 1/1 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100% + + + diff --git a/tests/.pest/snapshots/Unit/Result/EnabledProgressBar/to_console_with_data_set___10000__.snap b/tests/.pest/snapshots/Unit/Result/EnabledProgressBar/to_console_with_data_set___10000__.snap new file mode 100644 index 0000000..fdfd92d --- /dev/null +++ b/tests/.pest/snapshots/Unit/Result/EnabledProgressBar/to_console_with_data_set___10000__.snap @@ -0,0 +1,16 @@ + + + 0/1 [░░░░░░░░░░░░░░░░░░░░░░░░░░░░] 0% 1/1 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100% + + + ++-------+-------------------------------+------------------------------+ +| # | 0 | 1 | ++-------+-------------------------------+------------------------------+ +| min | 15.67890123 ms - 202 bytes | 2.3456789 ms - 102 bytes | +| max | 112.78901234 ms - 209 bytes | 9.75678901 ms - 109 bytes | +| avg | 53.02524845125 ms - 205 bytes | 5.94290024625 ms - 105 bytes | +| total | 424.20198761 ms - 1.61 KB | 47.54320197 ms - 844 bytes | ++-------+-------------------------------+------------------------------+ +| order | 2 | 1 | ++-------+-------------------------------+------------------------------+ diff --git a/tests/.pest/snapshots/Unit/Result/EnabledProgressBar/to_console_with_data_set___1000__.snap b/tests/.pest/snapshots/Unit/Result/EnabledProgressBar/to_console_with_data_set___1000__.snap new file mode 100644 index 0000000..fdfd92d --- /dev/null +++ b/tests/.pest/snapshots/Unit/Result/EnabledProgressBar/to_console_with_data_set___1000__.snap @@ -0,0 +1,16 @@ + + + 0/1 [░░░░░░░░░░░░░░░░░░░░░░░░░░░░] 0% 1/1 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100% + + + ++-------+-------------------------------+------------------------------+ +| # | 0 | 1 | ++-------+-------------------------------+------------------------------+ +| min | 15.67890123 ms - 202 bytes | 2.3456789 ms - 102 bytes | +| max | 112.78901234 ms - 209 bytes | 9.75678901 ms - 109 bytes | +| avg | 53.02524845125 ms - 205 bytes | 5.94290024625 ms - 105 bytes | +| total | 424.20198761 ms - 1.61 KB | 47.54320197 ms - 844 bytes | ++-------+-------------------------------+------------------------------+ +| order | 2 | 1 | ++-------+-------------------------------+------------------------------+ diff --git a/tests/.pest/snapshots/Unit/Result/EnabledProgressBar/to_console_with_data_set___3__.snap b/tests/.pest/snapshots/Unit/Result/EnabledProgressBar/to_console_with_data_set___3__.snap new file mode 100644 index 0000000..fdfd92d --- /dev/null +++ b/tests/.pest/snapshots/Unit/Result/EnabledProgressBar/to_console_with_data_set___3__.snap @@ -0,0 +1,16 @@ + + + 0/1 [░░░░░░░░░░░░░░░░░░░░░░░░░░░░] 0% 1/1 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100% + + + ++-------+-------------------------------+------------------------------+ +| # | 0 | 1 | ++-------+-------------------------------+------------------------------+ +| min | 15.67890123 ms - 202 bytes | 2.3456789 ms - 102 bytes | +| max | 112.78901234 ms - 209 bytes | 9.75678901 ms - 109 bytes | +| avg | 53.02524845125 ms - 205 bytes | 5.94290024625 ms - 105 bytes | +| total | 424.20198761 ms - 1.61 KB | 47.54320197 ms - 844 bytes | ++-------+-------------------------------+------------------------------+ +| order | 2 | 1 | ++-------+-------------------------------+------------------------------+ diff --git a/tests/.pest/snapshots/Unit/Result/EnabledProgressBar/to_data_with_data_set___10000__.snap b/tests/.pest/snapshots/Unit/Result/EnabledProgressBar/to_data_with_data_set___10000__.snap new file mode 100644 index 0000000..1f17a11 --- /dev/null +++ b/tests/.pest/snapshots/Unit/Result/EnabledProgressBar/to_data_with_data_set___10000__.snap @@ -0,0 +1,6 @@ + + + 0/1 [░░░░░░░░░░░░░░░░░░░░░░░░░░░░] 0% 1/1 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100% + + + diff --git a/tests/.pest/snapshots/Unit/Result/EnabledProgressBar/to_data_with_data_set___1000__.snap b/tests/.pest/snapshots/Unit/Result/EnabledProgressBar/to_data_with_data_set___1000__.snap new file mode 100644 index 0000000..1f17a11 --- /dev/null +++ b/tests/.pest/snapshots/Unit/Result/EnabledProgressBar/to_data_with_data_set___1000__.snap @@ -0,0 +1,6 @@ + + + 0/1 [░░░░░░░░░░░░░░░░░░░░░░░░░░░░] 0% 1/1 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100% + + + diff --git a/tests/.pest/snapshots/Unit/Result/EnabledProgressBar/to_data_with_data_set___3__.snap b/tests/.pest/snapshots/Unit/Result/EnabledProgressBar/to_data_with_data_set___3__.snap new file mode 100644 index 0000000..1f17a11 --- /dev/null +++ b/tests/.pest/snapshots/Unit/Result/EnabledProgressBar/to_data_with_data_set___3__.snap @@ -0,0 +1,6 @@ + + + 0/1 [░░░░░░░░░░░░░░░░░░░░░░░░░░░░] 0% 1/1 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100% + + + diff --git a/tests/Unit/Result/EnabledProgressBar.php b/tests/Unit/Result/EnabledProgressBar.php new file mode 100644 index 0000000..1af4843 --- /dev/null +++ b/tests/Unit/Result/EnabledProgressBar.php @@ -0,0 +1,30 @@ +iterations($iterations) + ->toConsole(); + + expectOutputToMatchSnapshot(); +})->with([3, 1000, 10000]); + +test('to data', function (int $iterations) { + (new Benchmark(collector: new CollectorFixture)) + ->iterations($iterations) + ->toData(); + + expectOutputToMatchSnapshot(); +})->with([3, 1000, 10000]); + +test('to assert', function (int $iterations) { + (new Benchmark(collector: new CollectorFixture)) + ->iterations($iterations) + ->toAssert(); + + expectOutputToMatchSnapshot(); +})->with([3, 1000, 10000]);