Skip to content

Commit 23c9385

Browse files
Added initial configuration
1 parent ab0f4cf commit 23c9385

File tree

15 files changed

+200
-224
lines changed

15 files changed

+200
-224
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
github: :vendor_name
1+
github: maurobaptista

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
blank_issues_enabled: false
22
contact_links:
33
- name: Ask a question
4-
url: https://github.com/:vendor_name/:package_name/discussions/new?category=q-a
4+
url: https://github.com/maurobaptista/phpunit-slow-tests/discussions/new?category=q-a
55
about: Ask the community for help
66
- name: Request a feature
7-
url: https://github.com/:vendor_name/:package_name/discussions/new?category=ideas
7+
url: https://github.com/maurobaptista/phpunit-slow-tests/discussions/new?category=ideas
88
about: Share ideas for new features
99
- name: Report a security issue
10-
url: https://github.com/:vendor_name/:package_name/security/policy
10+
url: https://github.com/maurobaptista/phpunit-slow-tests/security/policy
1111
about: Learn how to notify us for sensitive bugs
1212
- name: Report a bug
13-
url: https://github.com/:vendor_name/:package_name/issues/new
13+
url: https://github.com/maurobaptista/phpunit-slow-tests/issues/new
1414
about: Report a reproducable bug

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Changelog
22

3-
All notable changes to `:package_name` will be documented in this file.
3+
All notable changes to `phpunit-slow-tests` will be documented in this file.
44

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) :vendor_name <author@domain.com>
3+
Copyright (c) maurobaptista <mauro@carnou.com>
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 6 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,32 @@
11

2-
[<img src="https://github-ads.s3.eu-central-1.amazonaws.com/support-ukraine.svg?t=1" />](https://supportukrainenow.org)
2+
# Get a better overview of the slowest tests in your suite
33

4-
# :package_description
4+
[![Latest Version on Packagist](https://img.shields.io/packagist/v/maurobaptista/phpunit-slow-tests.svg?style=flat-square)](https://packagist.org/packages/maurobaptista/phpunit-slow-tests)
5+
[![Tests](https://github.com/maurobaptista/phpunit-slow-tests/actions/workflows/run-tests.yml/badge.svg?branch=main)](https://github.com/maurobaptista/phpunit-slow-tests/actions/workflows/run-tests.yml)
56

6-
[![Latest Version on Packagist](https://img.shields.io/packagist/v/:vendor_slug/:package_slug.svg?style=flat-square)](https://packagist.org/packages/:vendor_slug/:package_slug)
7-
[![Tests](https://github.com/:vendor_slug/:package_slug/actions/workflows/run-tests.yml/badge.svg?branch=main)](https://github.com/:vendor_slug/:package_slug/actions/workflows/run-tests.yml)
8-
[![Total Downloads](https://img.shields.io/packagist/dt/:vendor_slug/:package_slug.svg?style=flat-square)](https://packagist.org/packages/:vendor_slug/:package_slug)
9-
<!--delete-->
10-
---
11-
This package can be used as to scaffold a framework agnostic package. Follow these steps to get started:
12-
13-
1. Press the "Use template" button at the top of this repo to create a new repo with the contents of this skeleton
14-
2. Run "php ./configure.php" to run a script that will replace all placeholders throughout all the files
15-
3. Have fun creating your package.
16-
4. If you need help creating a package, consider picking up our <a href="https://laravelpackage.training">Laravel Package Training</a> video course.
17-
---
18-
<!--/delete-->
197
This is where your description should go. Try and limit it to a paragraph or two. Consider adding a small example.
208

21-
## Support us
22-
23-
[<img src="https://github-ads.s3.eu-central-1.amazonaws.com/:package_name.jpg?t=1" width="419px" />](https://spatie.be/github-ad-click/:package_name)
24-
25-
We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).
26-
27-
We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).
28-
299
## Installation
3010

3111
You can install the package via composer:
3212

3313
```bash
34-
composer require :vendor_slug/:package_slug
14+
composer require maurobaptista/phpunit-slow-tests
3515
```
3616

3717
## Usage
3818

39-
```php
40-
$skeleton = new VendorName\Skeleton();
41-
echo $skeleton->echoPhrase('Hello, VendorName!');
42-
```
19+
TBD
4320

4421
## Testing
4522

4623
```bash
4724
composer test
4825
```
4926

50-
## Changelog
51-
52-
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
53-
54-
## Contributing
55-
56-
Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.
57-
58-
## Security Vulnerabilities
59-
60-
Please review [our security policy](../../security/policy) on how to report security vulnerabilities.
61-
6227
## Credits
6328

64-
- [:author_name](https://github.com/:author_username)
65-
- [All Contributors](../../contributors)
29+
- [Mauro Baptista](https://github.com/maurobaptista)
6630

6731
## License
6832

composer.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
{
2-
"name": ":vendor_slug/:package_slug",
3-
"description": ":package_description",
2+
"name": "maurobaptista/phpunit-slow-tests",
3+
"description": "Get a better overview of the slowests tests in your suite",
44
"keywords": [
5-
":vendor_name",
6-
":package_slug"
5+
"maurobaptista",
6+
"phpunit-slow-tests"
77
],
8-
"homepage": "https://github.com/:vendor_slug/:package_slug",
8+
"homepage": "https://github.com/maurobaptista/phpunit-slow-tests",
99
"license": "MIT",
1010
"authors": [
1111
{
12-
"name": ":author_name",
13-
"email": "author@domain.com",
12+
"name": "Mauro Baptista",
13+
"email": "mauro@carnou.com",
1414
"role": "Developer"
1515
}
1616
],
@@ -19,22 +19,22 @@
1919
},
2020
"require-dev": {
2121
"friendsofphp/php-cs-fixer": "^3.0",
22-
"pestphp/pest": "^1.20",
23-
"spatie/ray": "^1.28"
22+
"nunomaduro/termwind": "^1.14",
23+
"phpunit/phpunit": "^9.5"
2424
},
2525
"autoload": {
2626
"psr-4": {
27-
"VendorName\\Skeleton\\": "src"
27+
"MauroBaptista\\SlowTests\\": "src"
2828
}
2929
},
3030
"autoload-dev": {
3131
"psr-4": {
32-
"VendorName\\Skeleton\\Tests\\": "tests"
32+
"MauroBaptista\\SlowTests\\Tests\\": "tests"
3333
}
3434
},
3535
"scripts": {
36-
"test": "vendor/bin/pest",
37-
"test-coverage": "vendor/bin/pest --coverage",
36+
"test": "vendor/bin/phpunit",
37+
"test-coverage": "vendor/bin/phpunit --coverage",
3838
"format": "vendor/bin/php-cs-fixer fix --allow-risky=yes"
3939
},
4040
"config": {

configure.php

Lines changed: 0 additions & 150 deletions
This file was deleted.

phpunit.xml.dist

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,18 @@
1919
verbose="true"
2020
>
2121
<testsuites>
22-
<testsuite name="VendorName Test Suite">
22+
<testsuite name="Test Suite">
2323
<directory>tests</directory>
2424
</testsuite>
2525
</testsuites>
26+
<extensions>
27+
<extension class="MauroBaptista\SlowTests\Extensions\ResultToCSV">
28+
<arguments>
29+
<string>build/result.csv</string>
30+
</arguments>
31+
</extension>
32+
<extension class="MauroBaptista\SlowTests\Extensions\SlowestTests" />
33+
</extensions>
2634
<coverage>
2735
<include>
2836
<directory suffix=".php">./src</directory>

src/Components.php

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
namespace MauroBaptista\SlowTests;
4+
5+
use Closure;
6+
use function Termwind\render;
7+
8+
class Components
9+
{
10+
private function block(string $message): void
11+
{
12+
render(<<<"HTML"
13+
<div class="p-2">
14+
$message
15+
</div>
16+
HTML);
17+
}
18+
19+
private function message(string $message, string $type, string $backgroundColor): string
20+
{
21+
return <<<"HTML"
22+
<div>
23+
<div class="px-1 bg-$backgroundColor-600">$type</div>
24+
<em class="ml-1">$message</em>
25+
</div>
26+
HTML;
27+
}
28+
29+
public function error(string $message, array $reasons = []): void
30+
{
31+
$message = $this->message($message, 'Error', 'red');
32+
33+
if (empty($reasons)) {
34+
$this->block($message);
35+
}
36+
37+
$message .= '<BR>';
38+
$message .= '<div class="font-bold">Possible reasons:</div>';
39+
40+
$list = array_reduce($reasons, function (?string $carry, string $reason) {
41+
return $carry . "<li>$reason</li>";
42+
});
43+
44+
$message .= "<ul>$list</ul>";
45+
46+
$this->block($message);
47+
}
48+
}

0 commit comments

Comments
 (0)