Skip to content

Commit 099ab4f

Browse files
committed
Add test for push/pull previous url
1 parent 273e926 commit 099ab4f

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
namespace Tests\Unit;
4+
5+
use Tests\TestCase;
6+
use Illuminate\Support\Facades\Session;
7+
use Oneofftech\Identities\Support\InteractsWithPreviousUrl;
8+
9+
class InteractWithPreviousUrlTest extends TestCase
10+
{
11+
use InteractsWithPreviousUrl;
12+
13+
public function test_previous_url_is_stored()
14+
{
15+
Session::shouldReceive('previousUrl')->andReturn('http://localhost/previous');
16+
17+
Session::shouldReceive('put')->once()->with('_oot.identities.previous_url', 'http://localhost/previous');
18+
19+
$this->savePreviousUrl();
20+
}
21+
22+
public function test_previous_url_can_be_retrieved()
23+
{
24+
Session::shouldReceive('previousUrl')->andReturnNull();
25+
26+
Session::shouldReceive('pull')->once()->with('_oot.identities.previous_url', 'http://localhost')->andReturn('http://localhost/previous');
27+
28+
$url = $this->getPreviousUrl();
29+
30+
$this->assertEquals('http://localhost/previous', $url);
31+
}
32+
}

0 commit comments

Comments
 (0)