mirror of
				https://github.com/Mibew/java.git
				synced 2025-10-31 10:31:07 +03:00 
			
		
		
		
	Added to the Mibew API the ability to use empty string as a signature
This commit is contained in:
		
							parent
							
								
									555898e446
								
							
						
					
					
						commit
						31b6d96fc9
					
				| @ -260,20 +260,6 @@ class MibewAPITest extends PHPUnit_Framework_TestCase { | ||||
| 			); | ||||
| 		} | ||||
| 
 | ||||
| 		// Wrong package. Signature element is empty.
 | ||||
| 		$wrong_package = array('signature' => ''); | ||||
| 
 | ||||
| 		// Try to catch MibewAPIException with MibewAPIException::EMPTY_SIGNATURE code
 | ||||
| 		try { | ||||
| 			$api->checkPackage($wrong_package, $trusted_signatures); | ||||
| 			$this->fail("Exception must be thrown"); | ||||
| 		} catch (MibewAPIException $e) { | ||||
| 			$this->assertEquals( | ||||
| 				MibewAPIException::EMPTY_SIGNATURE, | ||||
| 				$e->getCode() | ||||
| 			); | ||||
| 		} | ||||
| 
 | ||||
| 		// Wrong package. Signature is wrong.
 | ||||
| 		$wrong_package = array('signature' => 'wrong_signature'); | ||||
| 
 | ||||
|  | ||||
| @ -67,7 +67,7 @@ Class MibewAPI { | ||||
| 	 */ | ||||
| 	public function checkPackage($package, $trusted_signatures) { | ||||
| 		// Check signature
 | ||||
| 		if (empty($package['signature'])) { | ||||
| 		if (! isset($package['signature'])) { | ||||
| 			throw new MibewAPIException( | ||||
| 				"Package signature is empty", | ||||
| 				MibewAPIException::EMPTY_SIGNATURE | ||||
| @ -298,7 +298,7 @@ Class MibewAPI { | ||||
| 						MibewAPIException::RESULT_FUNCTION_ALREADY_EXISTS | ||||
| 					); | ||||
| 				} | ||||
| 				// Furst 'result' function found
 | ||||
| 				// First 'result' function found
 | ||||
| 				$result_function = $function; | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user