mirror of
				https://github.com/yiisoft/yii2.git
				synced 2025-11-04 22:57:40 +08:00 
			
		
		
		
	fixed auth manager unit test to not expect generic exception
This is not allowed by phpunit as a test may not fail anymore
This commit is contained in:
		@ -32,7 +32,7 @@ abstract class ManagerTestBase extends TestCase
 | 
				
			|||||||
		$this->assertEquals($item2->type, Item::TYPE_ROLE);
 | 
							$this->assertEquals($item2->type, Item::TYPE_ROLE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// test adding an item with the same name
 | 
							// test adding an item with the same name
 | 
				
			||||||
		$this->setExpectedException('Exception');
 | 
							$this->setExpectedException('\yii\base\Exception');
 | 
				
			||||||
		$this->auth->createItem($name, $type, $description, $bizRule, $data);
 | 
							$this->auth->createItem($name, $type, $description, $bizRule, $data);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -69,14 +69,14 @@ abstract class ManagerTestBase extends TestCase
 | 
				
			|||||||
		$this->auth->addItemChild('createPost', 'updatePost');
 | 
							$this->auth->addItemChild('createPost', 'updatePost');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// test adding upper level item to lower one
 | 
							// test adding upper level item to lower one
 | 
				
			||||||
		$this->setExpectedException('Exception');
 | 
							$this->setExpectedException('\yii\base\Exception');
 | 
				
			||||||
		$this->auth->addItemChild('readPost', 'reader');
 | 
							$this->auth->addItemChild('readPost', 'reader');
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public function testAddItemChild2()
 | 
						public function testAddItemChild2()
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		// test adding inexistent items
 | 
							// test adding inexistent items
 | 
				
			||||||
		$this->setExpectedException('Exception');
 | 
							$this->setExpectedException('\yii\base\Exception');
 | 
				
			||||||
		$this->assertFalse($this->auth->addItemChild('createPost2', 'updatePost'));
 | 
							$this->assertFalse($this->auth->addItemChild('createPost2', 'updatePost'));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -105,7 +105,7 @@ abstract class ManagerTestBase extends TestCase
 | 
				
			|||||||
		$this->assertEquals($auth->bizRule, 'rule');
 | 
							$this->assertEquals($auth->bizRule, 'rule');
 | 
				
			||||||
		$this->assertEquals($auth->data, 'data');
 | 
							$this->assertEquals($auth->data, 'data');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		$this->setExpectedException('Exception');
 | 
							$this->setExpectedException('\yii\base\Exception');
 | 
				
			||||||
		$this->auth->assign('new user', 'createPost2', 'rule', 'data');
 | 
							$this->auth->assign('new user', 'createPost2', 'rule', 'data');
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -158,7 +158,7 @@ abstract class ManagerTestBase extends TestCase
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	public function testDetectLoop()
 | 
						public function testDetectLoop()
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		$this->setExpectedException('Exception');
 | 
							$this->setExpectedException('\yii\base\Exception');
 | 
				
			||||||
		$this->auth->addItemChild('readPost', 'readPost');
 | 
							$this->auth->addItemChild('readPost', 'readPost');
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -15,6 +15,7 @@ use yii\helpers\StringHelper;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @author Qiang Xue <qiang.xue@gmail.com>
 | 
					 * @author Qiang Xue <qiang.xue@gmail.com>
 | 
				
			||||||
 | 
					 * @author Carsten Brandt <mail@cebe.cc>
 | 
				
			||||||
 * @since 2.0
 | 
					 * @since 2.0
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
class Response extends \yii\base\Response
 | 
					class Response extends \yii\base\Response
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user