Reenable Twitter/Show test
This commit is contained in:
		
					parent
					
						
							
								e10045f13f
							
						
					
				
			
			
				commit
				
					
						2b57266c88
					
				
			
		
					 2 changed files with 21 additions and 11 deletions
				
			
		|  | @ -38,7 +38,7 @@ class Show extends BaseApi | ||||||
| 		$uid = BaseApi::getCurrentUserID(); | 		$uid = BaseApi::getCurrentUserID(); | ||||||
| 
 | 
 | ||||||
| 		if (empty($this->parameters['id'])) { | 		if (empty($this->parameters['id'])) { | ||||||
| 			$cid = BaseApi::getContactIDForSearchterm($_REQUEST['screen_name'] ?? '', $_REQUEST['profileurl'] ?? '', $_REQUEST['user_id'] ?? 0, $uid); | 			$cid = BaseApi::getContactIDForSearchterm($request['screen_name'] ?? '', $request['profileurl'] ?? '', $request['user_id'] ?? 0, $uid); | ||||||
| 		} else { | 		} else { | ||||||
| 			$cid = (int)$this->parameters['id']; | 			$cid = (int)$this->parameters['id']; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|  | @ -2,6 +2,10 @@ | ||||||
| 
 | 
 | ||||||
| namespace Friendica\Test\src\Module\Api\Twitter\Users; | namespace Friendica\Test\src\Module\Api\Twitter\Users; | ||||||
| 
 | 
 | ||||||
|  | use Friendica\App\Router; | ||||||
|  | use Friendica\Capabilities\ICanCreateResponses; | ||||||
|  | use Friendica\DI; | ||||||
|  | use Friendica\Module\Api\Twitter\Users\Show; | ||||||
| use Friendica\Test\src\Module\Api\ApiTest; | use Friendica\Test\src\Module\Api\ApiTest; | ||||||
| 
 | 
 | ||||||
| class ShowTest extends ApiTest | class ShowTest extends ApiTest | ||||||
|  | @ -13,15 +17,17 @@ class ShowTest extends ApiTest | ||||||
| 	 */ | 	 */ | ||||||
| 	public function testApiUsersShow() | 	public function testApiUsersShow() | ||||||
| 	{ | 	{ | ||||||
| 		/* | 		$show = new Show(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET]); | ||||||
| 		$result = api_users_show('json'); | 		$response = $show->run(); | ||||||
|  | 
 | ||||||
|  | 		$json = $this->toJson($response); | ||||||
|  | 
 | ||||||
| 		// We can't use assertSelfUser() here because the user object is missing some properties.
 | 		// We can't use assertSelfUser() here because the user object is missing some properties.
 | ||||||
| 		self::assertEquals($this->selfUser['id'], $result['user']['cid']); | 		self::assertEquals(static::SELF_USER['id'], $json->cid); | ||||||
| 		self::assertEquals('DFRN', $result['user']['location']); | 		self::assertEquals('DFRN', $json->location); | ||||||
| 		self::assertEquals($this->selfUser['name'], $result['user']['name']); | 		self::assertEquals(static::SELF_USER['name'], $json->name); | ||||||
| 		self::assertEquals($this->selfUser['nick'], $result['user']['screen_name']); | 		self::assertEquals(static::SELF_USER['nick'], $json->screen_name); | ||||||
| 		self::assertTrue($result['user']['verified']); | 		self::assertTrue($json->verified); | ||||||
| 		*/ |  | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	/** | 	/** | ||||||
|  | @ -31,7 +37,11 @@ class ShowTest extends ApiTest | ||||||
| 	 */ | 	 */ | ||||||
| 	public function testApiUsersShowWithXml() | 	public function testApiUsersShowWithXml() | ||||||
| 	{ | 	{ | ||||||
| 		// $result = api_users_show('xml');
 | 		$show = new Show(DI::app(), DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::GET], ['extension' => ICanCreateResponses::TYPE_XML]); | ||||||
| 		// self::assertXml($result, 'statuses');
 | 		$response = $show->run(); | ||||||
|  | 
 | ||||||
|  | 		self::assertEquals(ICanCreateResponses::TYPE_XML, $response->getHeaderLine(ICanCreateResponses::X_HEADER)); | ||||||
|  | 
 | ||||||
|  | 		self::assertXml((string)$response->getBody(), 'statuses'); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue