diff --git a/src/Illuminate/Foundation/Testing/TestResponse.php b/src/Illuminate/Foundation/Testing/TestResponse.php index 776aececcb0c..6c1f9fd67fab 100644 --- a/src/Illuminate/Foundation/Testing/TestResponse.php +++ b/src/Illuminate/Foundation/Testing/TestResponse.php @@ -261,10 +261,10 @@ public function assertSee($value) */ public function assertSeeInOrder(array $values) { - $position = -1; + $position = 0; foreach ($values as $value) { - $valuePosition = mb_strpos($this->getContent(), $value); + $valuePosition = mb_strpos($this->getContent(), $value, $position); if ($valuePosition === false || $valuePosition < $position) { PHPUnit::fail( @@ -273,7 +273,7 @@ public function assertSeeInOrder(array $values) ); } - $position = $valuePosition; + $position = $valuePosition + mb_strlen($value); } return $this; @@ -300,10 +300,10 @@ public function assertSeeText($value) */ public function assertSeeTextInOrder(array $values) { - $position = -1; + $position = 0; foreach ($values as $value) { - $valuePosition = mb_strpos(strip_tags($this->getContent()), $value); + $valuePosition = mb_strpos(strip_tags($this->getContent()), $value, $position); if ($valuePosition === false || $valuePosition < $position) { PHPUnit::fail( @@ -312,7 +312,7 @@ public function assertSeeTextInOrder(array $values) ); } - $position = $valuePosition; + $position = $valuePosition + mb_strlen($value); } return $this; diff --git a/tests/Foundation/FoundationTestResponseTest.php b/tests/Foundation/FoundationTestResponseTest.php index be2fbe3bb669..6b8d80ffeba6 100644 --- a/tests/Foundation/FoundationTestResponseTest.php +++ b/tests/Foundation/FoundationTestResponseTest.php @@ -45,22 +45,26 @@ public function testAssertSeeInOrder() { $baseResponse = tap(new Response, function ($response) { $response->setContent(\Mockery::mock(View::class, [ - 'render' => '