Skip to content

Commit adb8637

Browse files
committed
Test suite update.
Configured GitHub Actions for automated testing. Readme update.
1 parent 1cc6ea5 commit adb8637

File tree

4 files changed

+38
-11
lines changed

4 files changed

+38
-11
lines changed

.github/workflows/tests.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Set up PHP
16+
uses: shivammathur/setup-php@v2
17+
with:
18+
php-version: '8.2'
19+
coverage: none
20+
21+
- name: Install dependencies
22+
run: composer install --no-interaction --prefer-dist
23+
24+
- name: Run test suite
25+
run: php tests/run.php

README.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@
44
55
## Why Power Primitives?
66

7-
Plain PHP arrays and strings are wonderfully flexible, yet they quickly turn
8-
into walls of procedural helper calls. Loop counters, temporary variables and
9-
manual checks for missing keys clutter the happy path of your application. The
10-
`PowerArray` and `PowerString` classes wrap native values in a lightweight
11-
object-oriented façade that embraces PHP 8 and makes common transformations
12-
readable, chainable and safe.
7+
Plain PHP arrays and strings are wonderfully flexible, yet they quickly turn into walls of procedural helper calls.
8+
Loop counters, temporary variables and manual checks for missing keys clutter the happy path of your application.
9+
10+
The `PowerArray` and `PowerString` classes wrap native values in a lightweight object-oriented facade that embraces PHP 8 and makes common transformations readable, chainable and safe.
1311

1412
```php
1513
<?php
@@ -22,8 +20,7 @@ $emails = PA($users)
2220
->all();
2321
```
2422

25-
No temporary arrays, no custom utility library scattered throughout your
26-
project—just fluent, discoverable methods that compose naturally.
23+
No temporary arrays, no custom utility library scattered throughout your project — just fluent, discoverable methods that compose naturally.
2724

2825
## Installation
2926

tests/TestSuite.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,17 @@ private function printSummary(): void
4343
$total = count($this->results);
4444
$failures = array_filter($this->results, static fn(array $result): bool => !$result['success']);
4545

46-
foreach ($this->results as $result) {
46+
$digits = max(2, strlen((string) $total));
47+
48+
foreach ($this->results as $index => $result) {
49+
$number = str_pad((string) ($index + 1), $digits, '0', STR_PAD_LEFT);
50+
4751
if ($result['success']) {
48-
echo "{$result['name']}\n";
52+
echo "{$number}. {$result['name']}\n";
4953
} else {
5054
/** @var Throwable $error */
5155
$error = $result['error'];
52-
echo "{$result['name']}\n {$error->getMessage()}\n";
56+
echo "{$number}. {$result['name']}\n {$error->getMessage()}\n";
5357
}
5458
}
5559

tests/run.php

100644100755
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#!/usr/bin/env php
12
<?php
23

34
declare(strict_types=1);

0 commit comments

Comments
 (0)