mirror of
				https://github.com/yiisoft/yii2.git
				synced 2025-10-31 02:28:35 +08:00 
			
		
		
		
	Fix #20447: Fix behavior for yii\web\Controller::bindActionParams around mixed type
				
					
				
			This commit is contained in:
		 Christina Reichel
					Christina Reichel
				
			
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			 GitHub
						GitHub
					
				
			
						parent
						
							5468bca7bc
						
					
				
				
					commit
					5aabdd3a21
				
			| @ -254,6 +254,17 @@ class ControllerTest extends TestCase | ||||
|         list($foo) = $this->controller->bindActionParams($stringy, ['foo' => '']); | ||||
|         $this->assertSame('', $foo); | ||||
|  | ||||
|         // make sure mixed type works | ||||
|         $params = ['foo' => 100]; | ||||
|         $mixedParameter = new InlineAction('mixed-parameter', $this->controller, 'actionMixedParameter'); | ||||
|         list($foo) = $this->controller->bindActionParams($mixedParameter, $params); | ||||
|         $this->assertSame(100, $foo); | ||||
|         $params = ['foo' => 'foobar']; | ||||
|         $mixedParameter = new InlineAction('mixed-parameter', $this->controller, 'actionMixedParameter'); | ||||
|         list($foo) = $this->controller->bindActionParams($mixedParameter, $params); | ||||
|         $this->assertSame('foobar', $foo); | ||||
|  | ||||
|  | ||||
|         $params = ['foo' => 'oops', 'bar' => null]; | ||||
|         $this->expectException('yii\web\BadRequestHttpException'); | ||||
|         $this->expectExceptionMessage('Invalid data received for parameter "foo".'); | ||||
|  | ||||
		Reference in New Issue
	
	Block a user