Skip to content

Commit de5f6a7

Browse files
authored
[8.x] Make ResponseSequence macroable (#36719)
* make ResponseSequence macroable * cs
1 parent c04fa17 commit de5f6a7

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/Illuminate/Http/Client/ResponseSequence.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22

33
namespace Illuminate\Http\Client;
44

5+
use Illuminate\Support\Traits\Macroable;
56
use OutOfBoundsException;
67

78
class ResponseSequence
89
{
10+
use Macroable;
11+
912
/**
1013
* The responses in the sequence.
1114
*

tests/Http/HttpClientTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Illuminate\Http\Client\Request;
88
use Illuminate\Http\Client\RequestException;
99
use Illuminate\Http\Client\Response;
10+
use Illuminate\Http\Client\ResponseSequence;
1011
use Illuminate\Support\Collection;
1112
use Illuminate\Support\Str;
1213
use OutOfBoundsException;
@@ -802,4 +803,13 @@ public function testCanDump()
802803

803804
VarDumper::setHandler(null);
804805
}
806+
807+
public function testResponseSequenceIsMacroable()
808+
{
809+
ResponseSequence::macro('customMethod', function () {
810+
return 'yes!';
811+
});
812+
813+
$this->assertSame('yes!', $this->factory->fakeSequence()->customMethod());
814+
}
805815
}

0 commit comments

Comments
 (0)