Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze authored and github-actions[bot] committed Jan 23, 2024
1 parent 75c8a2e commit e08f48b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/Checks/Checks/BackupsCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ class BackupsCheck extends Check
protected int $minimumSizeInMegabytes = 0;

protected ?int $minimumNumberOfBackups = null;
protected ?int $maximumNumberOfBackups = null;

protected ?int $maximumNumberOfBackups = null;

public function locatedAt(string $globPath): self
{
Expand Down Expand Up @@ -51,7 +51,7 @@ public function atLeastSizeInMb(int $minimumSizeInMegabytes): self
return $this;
}

public function numberOfBackups(int $min = null, int $max = null): self
public function numberOfBackups(?int $min = null, ?int $max = null): self
{
$this->minimumNumberOfBackups = $min;
$this->maximumNumberOfBackups = $max;
Expand Down
22 changes: 11 additions & 11 deletions tests/Checks/BackupsCheckTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
use Spatie\Health\Enums\Status;
use Spatie\Health\Facades\Health;
use Spatie\TemporaryDirectory\TemporaryDirectory;

use function Spatie\PestPluginTestTime\testTime;

beforeEach(function() {
beforeEach(function () {
$this->backupsCheck = BackupsCheck::new();

Health::checks([
Expand All @@ -19,7 +20,7 @@

});

it('it will succeed if a file with the given glob exist', function() {
it('it will succeed if a file with the given glob exist', function () {
addTestFile($this->temporaryDirectory->path('hey.zip'));

$result = $this->backupsCheck
Expand All @@ -29,7 +30,7 @@
expect($result)->status->toBe(Status::ok());
});

it('it will fail if a file with the given glob does not exist', function() {
it('it will fail if a file with the given glob does not exist', function () {
addTestFile($this->temporaryDirectory->path('hey.other'));

$result = $this->backupsCheck
Expand All @@ -39,15 +40,15 @@
expect($result)->status->toBe(Status::failed());
});

it('will fail if the given directory does not exist', function() {
it('will fail if the given directory does not exist', function () {
$result = $this->backupsCheck
->locatedAt('non-existing-directory')
->run();

expect($result)->status->toBe(Status::failed());
});

it('will fail if the backup is smaller than the given size', function() {
it('will fail if the backup is smaller than the given size', function () {
addTestFile($this->temporaryDirectory->path('hey.zip'), sizeInMb: 4);

$result = $this->backupsCheck
Expand All @@ -58,7 +59,7 @@
expect($result)->status->toBe(Status::failed());
});

it('will pass if the backup is at least than the given size', function(int $sizeInMb) {
it('will pass if the backup is at least than the given size', function (int $sizeInMb) {
addTestFile($this->temporaryDirectory->path('hey.zip'), sizeInMb: $sizeInMb);

$result = $this->backupsCheck
Expand All @@ -72,7 +73,7 @@
[6],
]);

it('can check if the youngest backup is recent enough', function() {
it('can check if the youngest backup is recent enough', function () {
addTestFile($this->temporaryDirectory->path('hey.zip'));

testTime()->addMinutes(4);
Expand All @@ -92,7 +93,7 @@
expect($result)->status->toBe(Status::failed());
});

it('can check if the oldest backup is old enough', function() {
it('can check if the oldest backup is old enough', function () {
addTestFile($this->temporaryDirectory->path('hey.zip'), date: now()->startOfMinute());

testTime()->addMinutes(4);
Expand All @@ -113,7 +114,7 @@
expect($result)->status->toBe(Status::failed());
});

it('can check that there are enough backups', function() {
it('can check that there are enough backups', function () {
addTestFile($this->temporaryDirectory->path('first.zip'));

$result = $this->backupsCheck
Expand All @@ -131,8 +132,7 @@
expect($result)->status->toBe(Status::ok());
});


it('can make sure that there are not too much backups', function() {
it('can make sure that there are not too much backups', function () {
addTestFile($this->temporaryDirectory->path('first.zip'));
addTestFile($this->temporaryDirectory->path('second.zip'));

Expand Down

0 comments on commit e08f48b

Please sign in to comment.