You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			
				
					33 lines
				
				857 B
			
		
		
			
		
	
	
					33 lines
				
				857 B
			| 
								 
											12 years ago
										 
									 | 
							
								<?php
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								namespace yiiunit\extensions\authclient\oauth;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 
											12 years ago
										 
									 | 
							
								use yii\authclient\OAuth2;
							 | 
						||
| 
								 
											12 years ago
										 
									 | 
							
								use yiiunit\extensions\authclient\TestCase;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 
											12 years ago
										 
									 | 
							
								class OAuth2Test extends TestCase
							 | 
						||
| 
								 
											12 years ago
										 
									 | 
							
								{
							 | 
						||
| 
								 | 
							
									protected function setUp()
							 | 
						||
| 
								 | 
							
									{
							 | 
						||
| 
								 | 
							
										$this->mockApplication([], '\yii\web\Application');
							 | 
						||
| 
								 | 
							
									}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									// Tests :
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									public function testBuildAuthUrl()
							 | 
						||
| 
								 | 
							
									{
							 | 
						||
| 
								 
											12 years ago
										 
									 | 
							
										$oauthClient = new OAuth2();
							 | 
						||
| 
								 
											12 years ago
										 
									 | 
							
										$authUrl = 'http://test.auth.url';
							 | 
						||
| 
								 | 
							
										$oauthClient->authUrl = $authUrl;
							 | 
						||
| 
								 | 
							
										$clientId = 'test_client_id';
							 | 
						||
| 
								 | 
							
										$oauthClient->clientId = $clientId;
							 | 
						||
| 
								 | 
							
										$returnUrl = 'http://test.return.url';
							 | 
						||
| 
								 | 
							
										$oauthClient->setReturnUrl($returnUrl);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
										$builtAuthUrl = $oauthClient->buildAuthUrl();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
										$this->assertContains($authUrl, $builtAuthUrl, 'No auth URL present!');
							 | 
						||
| 
								 | 
							
										$this->assertContains($clientId, $builtAuthUrl, 'No client id present!');
							 | 
						||
| 
								 | 
							
										$this->assertContains(rawurlencode($returnUrl), $builtAuthUrl, 'No return URL present!');
							 | 
						||
| 
								 | 
							
									}
							 | 
						||
| 
								 | 
							
								}
							 |