mirror of
				https://github.com/yiisoft/yii2.git
				synced 2025-11-04 14:46:19 +08:00 
			
		
		
		
	Method "YiiRequirementChecker::check()" has been refactored to be used in method chain.
Methods "YiiRequirementChecker::getResults()" and "YiiRequirementChecker::render()" have been added.
This commit is contained in:
		@ -38,7 +38,7 @@ class YiiRequirementCheckerTest extends TestCase
 | 
				
			|||||||
			),
 | 
								),
 | 
				
			||||||
		);
 | 
							);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		$checkResult = $requirementsChecker->check($requirements);
 | 
							$checkResult = $requirementsChecker->check($requirements)->getResult();
 | 
				
			||||||
		$summary = $checkResult['summary'];
 | 
							$summary = $checkResult['summary'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		$this->assertEquals(count($requirements), $summary['total'], 'Wrong summary total!');
 | 
							$this->assertEquals(count($requirements), $summary['total'], 'Wrong summary total!');
 | 
				
			||||||
 | 
				
			|||||||
@ -49,7 +49,33 @@ class YiiRequirementChecker
 | 
				
			|||||||
			'summary' => $summary,
 | 
								'summary' => $summary,
 | 
				
			||||||
			'requirements' => $requirements,
 | 
								'requirements' => $requirements,
 | 
				
			||||||
		);
 | 
							);
 | 
				
			||||||
		return $result;
 | 
							$this->result = $result;
 | 
				
			||||||
 | 
							return $this;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/**
 | 
				
			||||||
 | 
						 * Return the check results.
 | 
				
			||||||
 | 
						 * @return array|null check results.
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						function getResult()
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							if (isset($this->result)) {
 | 
				
			||||||
 | 
								return $this->result;
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								return null;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/**
 | 
				
			||||||
 | 
						 * Renders the requirements check result.
 | 
				
			||||||
 | 
						 * The output will vary depending is a script running from web or from console.
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						function render()
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							if (isset($this->result)) {
 | 
				
			||||||
 | 
								$this->usageError('Nothing to render!');
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							// @todo render
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user