Skip to content

Commit

Permalink
add BooleanWildcard (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
bitladen-jw committed Jan 29, 2020
1 parent cdae9f3 commit 7e3f489
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ final class MyUnitTest extends TestCase
This ignores the concrete uuid given for the field "id" and only checks that a valid uuid is provided.

The library currently supports the following wildcards:
- BooleanWildcard
- IntegerWildcard
- UuidWildcard
- DateTimeWildcard
Expand Down
31 changes: 31 additions & 0 deletions src/Wildcard/BooleanWildcard.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

namespace KigaRoo\SnapshotTesting\Wildcard;

use function is_bool;

final class BooleanWildcard implements Wildcard
{
/** @var string */
private $path;

public function __construct(string $path)
{
$this->path = $path;
}

public function atPath() : string
{
return $this->path;
}

/**
* @param mixed $mixed
*/
public function match($mixed) : bool
{
return is_bool($mixed);
}
}

0 comments on commit 7e3f489

Please sign in to comment.