This repository was archived by the owner on Jul 1, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathRedfoxMiddlewareTest.php
More file actions
71 lines (59 loc) · 1.83 KB
/
RedfoxMiddlewareTest.php
File metadata and controls
71 lines (59 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
use App\Helpers\Guzzle\Exceptions\NotAuthenticatedException;
use App\Helpers\Guzzle\Middleware\RedfoxMiddleware;
use GuzzleHttp\Client;
use GuzzleHttp\Handler\MockHandler;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Psr7\Response;
class RedfoxMiddlewareTest extends TestCase
{
/**
* @group engine
*/
public function testRedfoxSuccessAuth()
{
$this->createApplication();
$html = View::make('mocks.redfox.login')->render();
$mock = new MockHandler([
new Response(200, [], $html),
new Response(200, [], ''),
new Response(200, [], ''),
]);
$stack = HandlerStack::create($mock);
$stack->push(new RedfoxMiddleware([], 0));
$client = new Client([
'handler' => $stack,
'debug' => true,
'http_errors' => false,
]);
$client->get('test');
}
/**
* @group engine
*/
public function testRedfoxFailAuth()
{
$this->createApplication();
$html = View::make('mocks.redfox.login')->render();
$mock = new MockHandler([
new Response(200, [], $html),
new Response(200, [], $html),
]);
$stack = HandlerStack::create($mock);
$stack->push(new RedfoxMiddleware([], 0));
$client = new Client([
'handler' => $stack,
'http_errors' => false,
]);
$this->setExpectedException(NotAuthenticatedException::class);
$client->get('play');
}
public function testWithEngine() {
// todo
$this->assertTrue(true, 'temporaly disabled');
// $engine = new RedfoxSafariEngine(94986676);
// $list = $engine->getQuestList();
// $quest = $engine->getRawHtml(2061);
// $this->assertGreaterThan(0, count($list));
}
}