Skip to content

Commit

Permalink
Expect tests to not perform assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromegamez committed Mar 17, 2024
1 parent e5ce896 commit 97dfadd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
3 changes: 1 addition & 2 deletions tests/HelpersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use DateTimeInterface;
use Gamez\Illuminate\Support\TypedCollection;
use InvalidArgumentException;
use PHPUnit\Framework\Attributes\DoesNotPerformAssertions;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;

Expand All @@ -23,14 +24,12 @@ public function it_can_be_created_with_supported_types(): void
{
$typedCollection = typedCollect([new DateTime(), new DateTime()], DateTimeInterface::class);
$this->assertInstanceOf(TypedCollection::class, $typedCollection);
$this->addToAssertionCount(1);
}

#[Test]
public function it_can_accept_an_array_of_types(): void
{
$typedCollection = typedCollect([new DateTime(), new ArrayableItem()], [DateTimeInterface::class, ArrayableItem::class]);
$this->assertInstanceOf(TypedCollection::class, $typedCollection);
$this->addToAssertionCount(1);
}
}
3 changes: 2 additions & 1 deletion tests/LazyTypedCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use DateTimeImmutable;
use Gamez\Illuminate\Support\LazyTypedCollection;
use InvalidArgumentException;
use PHPUnit\Framework\Attributes\DoesNotPerformAssertions;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use Illuminate\Support\LazyCollection;
Expand All @@ -32,10 +33,10 @@ public function it_cannot_be_created_with_an_unsupported_type_of_item(): void
}

#[Test]
#[DoesNotPerformAssertions]
public function it_can_be_created_with_supported_types(): void
{
new LazyDateTimeCollection([new DateTime(), new DateTime(), new DateTime()]);
$this->addToAssertionCount(1);
}

#[Test]
Expand Down
11 changes: 6 additions & 5 deletions tests/TypedCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Gamez\Illuminate\Support\TypedCollection;
use Illuminate\Support\Collection;
use InvalidArgumentException;
use PHPUnit\Framework\Attributes\DoesNotPerformAssertions;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;

Expand All @@ -28,17 +29,17 @@ public function it_cannot_be_created_with_an_unsupported_type_of_item(): void
}

#[Test]
#[DoesNotPerformAssertions]
public function it_can_be_created_with_supported_types(): void
{
new DateTimeCollection([new DateTime(), new DateTime(), new DateTime()]);
$this->addToAssertionCount(1);
}

#[Test]
#[DoesNotPerformAssertions]
public function a_supported_value_can_be_added(): void
{
$this->collection->add(new DateTime());
$this->addToAssertionCount(1);
}

#[Test]
Expand All @@ -49,10 +50,10 @@ public function an_unsupported_value_can_not_be_added(): void
}

#[Test]
#[DoesNotPerformAssertions]
public function a_supported_value_can_be_prepended(): void
{
$this->collection->prepend(new DateTime());
$this->addToAssertionCount(1);
}

#[Test]
Expand All @@ -63,10 +64,10 @@ public function an_unsupported_value_can_not_be_prepended(): void
}

#[Test]
#[DoesNotPerformAssertions]
public function a_supported_value_can_be_pushed(): void
{
$this->collection->push(new DateTime());
$this->addToAssertionCount(1);
}

#[Test]
Expand All @@ -77,10 +78,10 @@ public function an_unsupported_value_can_not_be_pushed(): void
}

#[Test]
#[DoesNotPerformAssertions]
public function a_supported_value_can_be_put(): void
{
$this->collection->put('key', new DateTime());
$this->addToAssertionCount(1);
}

#[Test]
Expand Down

0 comments on commit 97dfadd

Please sign in to comment.