diff --git a/src/Concerns/MakesAssertions.php b/src/Concerns/MakesAssertions.php index e7c1f82e6..dd4bf9693 100644 --- a/src/Concerns/MakesAssertions.php +++ b/src/Concerns/MakesAssertions.php @@ -206,40 +206,40 @@ public function assertDontSeeIn($selector, $text) } /** - * Assert that the given selector has no text. + * Assert that the given selector has some text. * * @param string $selector * @return $this */ - public function assertSeeEmptyTextIn($selector) + public function assertSeeAnythingIn($selector) { $fullSelector = $this->resolver->format($selector); $element = $this->resolver->findOrFail($selector); PHPUnit::assertTrue( - $element->getText() === '', - "Did not see expected text [''] within element [{$fullSelector}]." + $element->getText() !== '', + "Saw unexpected text [''] within element [{$fullSelector}]." ); return $this; } /** - * Assert that the given selector has some text. + * Assert that the given selector has no text. * * @param string $selector * @return $this */ - public function assertDontSeeEmptyTextIn($selector) + public function assertSeeNothingIn($selector) { $fullSelector = $this->resolver->format($selector); $element = $this->resolver->findOrFail($selector); PHPUnit::assertTrue( - $element->getText() !== '', - "Saw unexpected text [''] within element [{$fullSelector}]." + $element->getText() === '', + "Did not see expected text [''] within element [{$fullSelector}]." ); return $this; diff --git a/tests/MakesAssertionsTest.php b/tests/MakesAssertionsTest.php index e5563549c..2b0fb0b6a 100644 --- a/tests/MakesAssertionsTest.php +++ b/tests/MakesAssertionsTest.php @@ -1131,7 +1131,7 @@ public function test_assert_see_empty_text_in_element_with_empty_text() $browser = new Browser($driver, $resolver); - $browser->assertSeeEmptyTextIn('foo'); + $browser->assertSeeNothingIn('foo'); } public function test_assert_see_empty_text_in_element_without_empty_text() @@ -1148,7 +1148,7 @@ public function test_assert_see_empty_text_in_element_without_empty_text() $browser = new Browser($driver, $resolver); try { - $browser->assertSeeEmptyTextIn('foo'); + $browser->assertSeeNothingIn('foo'); } catch (ExpectationFailedException $e) { $this->assertStringContainsString( 'Did not see expected text [\'\'] within element [body foo].', @@ -1171,7 +1171,7 @@ public function test_assert_dont_see_empty_text_in_element_with_empty_text() $browser = new Browser($driver, $resolver); try { - $browser->assertDontSeeEmptyTextIn('foo'); + $browser->assertSeeAnythingIn('foo'); } catch (ExpectationFailedException $e) { $this->assertStringContainsString( 'Saw unexpected text [\'\'] within element [body foo].', @@ -1193,7 +1193,7 @@ public function test_assert_dont_see_empty_text_in_element_without_empty_text() $browser = new Browser($driver, $resolver); - $browser->assertDontSeeEmptyTextIn('foo'); + $browser->assertSeeAnythingIn('foo'); } public function test_assert_source_has()