@@ 51-84 (lines=34) @@ | ||
48 | ; |
|
49 | } |
|
50 | ||
51 | public function testExecute(): void |
|
52 | { |
|
53 | $accessToken = $this->prepareAccessToken(); |
|
54 | ||
55 | $graphUser = $this->prophesize(GraphUser::class); |
|
56 | ||
57 | $response = $this->prophesize(FacebookResponse::class); |
|
58 | $response->getGraphUser() |
|
59 | ->willReturn($graphUser) |
|
60 | ; |
|
61 | ||
62 | $this->facebook->get('/me?fields=id,name', $accessToken) |
|
63 | ->willReturn($response) |
|
64 | ; |
|
65 | ||
66 | $this->sessionManager->store(Argument::type(SessionInterface::class)) |
|
67 | ->shouldBeCalled() |
|
68 | ; |
|
69 | ||
70 | $this->router->generate('core23_facebook_success', [], UrlGeneratorInterface::ABSOLUTE_PATH) |
|
71 | ->willReturn('/success') |
|
72 | ->shouldBeCalled() |
|
73 | ; |
|
74 | ||
75 | $action = new CheckAuthAction( |
|
76 | $this->router->reveal(), |
|
77 | $this->facebook->reveal(), |
|
78 | $this->sessionManager->reveal() |
|
79 | ); |
|
80 | ||
81 | $response = $action(); |
|
82 | ||
83 | static::assertSame('/success', $response->getTargetUrl()); |
|
84 | } |
|
85 | ||
86 | public function testExecuteWithApiError(): void |
|
87 | { |
|
@@ 86-115 (lines=30) @@ | ||
83 | static::assertSame('/success', $response->getTargetUrl()); |
|
84 | } |
|
85 | ||
86 | public function testExecuteWithApiError(): void |
|
87 | { |
|
88 | $accessToken = $this->prepareAccessToken(); |
|
89 | ||
90 | $graphUser = $this->prophesize(GraphUser::class); |
|
91 | ||
92 | $response = $this->prophesize(FacebookResponse::class); |
|
93 | $response->getGraphUser() |
|
94 | ->willReturn($graphUser) |
|
95 | ; |
|
96 | ||
97 | $this->facebook->get('/me?fields=id,name', $accessToken) |
|
98 | ->willThrow(FacebookSDKException::class) |
|
99 | ; |
|
100 | ||
101 | $this->router->generate('core23_facebook_error', [], UrlGeneratorInterface::ABSOLUTE_PATH) |
|
102 | ->willReturn('/error') |
|
103 | ->shouldBeCalled() |
|
104 | ; |
|
105 | ||
106 | $action = new CheckAuthAction( |
|
107 | $this->router->reveal(), |
|
108 | $this->facebook->reveal(), |
|
109 | $this->sessionManager->reveal() |
|
110 | ); |
|
111 | ||
112 | $response = $action(); |
|
113 | ||
114 | static::assertSame('/error', $response->getTargetUrl()); |
|
115 | } |
|
116 | ||
117 | public function testExecuteWithNoAccessToken(): void |
|
118 | { |