Skip to content

Commit

Permalink
Update MakesAssertionsTest.php
Browse files Browse the repository at this point in the history
  • Loading branch information
ktsm-th committed Jan 31, 2025
1 parent f3d2a81 commit 54bb3ad
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/Unit/MakesAssertionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1257,6 +1257,32 @@ public function test_assert_vue_contains_with_no_result()
}
}

public function test_assert_count()
{
$driver = m::mock(stdClass::class);

$element1 = m::mock(RemoteWebElement::class);
$element2 = m::mock(RemoteWebElement::class);

$resolver = m::mock(stdClass::class);
$resolver->shouldReceive('format')->with('foo')->andReturn('body foo');
$resolver->shouldReceive('all')->with('foo')->andReturn([$element1, $element2]);

$browser = new Browser($driver, $resolver);

$browser->assertCount('foo', 2);

try {
$browser->assertCount('foo', 3);
$this->fail();
} catch (ExpectationFailedException $e) {
$this->assertStringContainsString(
'Expected element [body foo] exactly 3 times.',
$e->getMessage()
);
}
}

public function test_assert_script()
{
$driver = m::mock(stdClass::class);
Expand Down

0 comments on commit 54bb3ad

Please sign in to comment.