Skip to content

Commit 72b5017

Browse files
authored
Revert "[11.x] assertSee handle empty values (#47597)" (#47604)
This reverts commit ceb3f18.
1 parent ceb3f18 commit 72b5017

File tree

2 files changed

+1
-65
lines changed

2 files changed

+1
-65
lines changed

src/Illuminate/Testing/TestResponse.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -518,21 +518,13 @@ public function assertStreamedContent($value)
518518
* @param bool $escape
519519
* @return $this
520520
*/
521-
public function assertSee($value, $escape = true, $allowEmptyValues = false)
521+
public function assertSee($value, $escape = true)
522522
{
523523
$value = Arr::wrap($value);
524524

525-
if (! $allowEmptyValues && empty($value)) {
526-
PHPUnit::fail('An empty value was passed to `assertSee`.');
527-
}
528-
529525
$values = $escape ? array_map('e', $value) : $value;
530526

531527
foreach ($values as $value) {
532-
if (! $allowEmptyValues && (string) $value === '') {
533-
PHPUnit::fail('An empty value was passed to `assertSee`.');
534-
}
535-
536528
PHPUnit::assertStringContainsString((string) $value, $this->getContent());
537529
}
538530

tests/Testing/TestResponseTest.php

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -329,62 +329,6 @@ public function testAssertSeeEscapedCanFail()
329329
$response->assertSee(['bar & baz', 'baz & qux']);
330330
}
331331

332-
public function testAssertSeeCatchesNullValue()
333-
{
334-
$this->expectException(AssertionFailedError::class);
335-
336-
$response = $this->makeMockResponse([
337-
'render' => '<ul><li>foo</li><li>bar</li><li>baz</li><li>foo</li></ul>',
338-
]);
339-
340-
$response->assertSee(null);
341-
}
342-
343-
public function testAssertSeeCatchesEmptyArray()
344-
{
345-
$this->expectException(AssertionFailedError::class);
346-
347-
$response = $this->makeMockResponse([
348-
'render' => '<ul><li>foo</li><li>bar</li><li>baz</li><li>foo</li></ul>',
349-
]);
350-
351-
$response->assertSee([]);
352-
}
353-
354-
public function testAssertSeeCatchesEmptyString()
355-
{
356-
$this->expectException(AssertionFailedError::class);
357-
358-
$response = $this->makeMockResponse([
359-
'render' => '<ul><li>foo</li><li>bar</li><li>baz</li><li>foo</li></ul>',
360-
]);
361-
362-
$response->assertSee('');
363-
}
364-
365-
public function testAssertSeeCatchesEmptyStringInArray()
366-
{
367-
$this->expectException(AssertionFailedError::class);
368-
369-
$response = $this->makeMockResponse([
370-
'render' => '<ul><li>foo</li><li>bar</li><li>baz</li><li>foo</li></ul>',
371-
]);
372-
373-
$response->assertSee(['foo', '', 'bar']);
374-
}
375-
376-
public function testAssertSeeAllowsEmptyValues()
377-
{
378-
$response = $this->makeMockResponse([
379-
'render' => '<ul><li>foo</li><li>bar</li><li>baz</li><li>foo</li></ul>',
380-
]);
381-
382-
$response->assertSee(null, allowEmptyValues: true);
383-
$response->assertSee([], allowEmptyValues: true);
384-
$response->assertSee('', allowEmptyValues: true);
385-
$response->assertSee(['foo', '', 'bar'], allowEmptyValues: true);
386-
}
387-
388332
public function testAssertSeeInOrder()
389333
{
390334
$response = $this->makeMockResponse([

0 commit comments

Comments
 (0)