8 changed files with 6 additions and 107 deletions
			
			
		@ -1,56 +0,0 @@
					 | 
				
			||||
<?php | 
				
			||||
 | 
				
			||||
namespace tests\_helpers; | 
				
			||||
 | 
				
			||||
class TestCase extends \PHPUnit_Framework_TestCase | 
				
			||||
{ | 
				
			||||
 | 
				
			||||
	/** | 
				
			||||
	 * Your application config, will be merged with base config when creating application. | 
				
			||||
	 * @var array | 
				
			||||
	 */ | 
				
			||||
	protected $config = array(); | 
				
			||||
 | 
				
			||||
	/** | 
				
			||||
	 * Created application class | 
				
			||||
	 * @var string | 
				
			||||
	 */ | 
				
			||||
	protected $appClass = '\yii\web\Application'; | 
				
			||||
 | 
				
			||||
	protected function setUp() | 
				
			||||
	{ | 
				
			||||
		parent::setUp(); | 
				
			||||
		$this->mockApplication(); | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	protected function tearDown() | 
				
			||||
	{ | 
				
			||||
		$this->destroyApplication(); | 
				
			||||
		parent::tearDown(); | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	protected function mockApplication() | 
				
			||||
	{ | 
				
			||||
		$baseConfig = require(__DIR__.'/../unit/_bootstrap.php'); | 
				
			||||
		$config = \yii\helpers\ArrayHelper::merge($baseConfig,$this->config); | 
				
			||||
		new $this->appClass($config); | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	protected function destroyApplication() | 
				
			||||
	{ | 
				
			||||
		\Yii::$app = null; | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	/** | 
				
			||||
	 * Use this method when you need to dump variables with var_dump function. | 
				
			||||
	 * This is caused by the buffering output of the codeception. | 
				
			||||
	 * @param mixed $var | 
				
			||||
	 */ | 
				
			||||
	protected static function varDump($var) | 
				
			||||
	{ | 
				
			||||
		ob_start(); | 
				
			||||
		var_dump($var); | 
				
			||||
		\Codeception\Util\Debug::debug(ob_get_clean()); | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -1,45 +0,0 @@
					 | 
				
			||||
<?php | 
				
			||||
 | 
				
			||||
namespace tests\_pages; | 
				
			||||
 | 
				
			||||
class BasePage | 
				
			||||
{ | 
				
			||||
 | 
				
			||||
	// include url of current page | 
				
			||||
	public static $URL = ''; | 
				
			||||
 | 
				
			||||
	/** | 
				
			||||
	 * Declare UI map for this page here. CSS or XPath allowed. | 
				
			||||
	 * public static $usernameField = '#username'; | 
				
			||||
	 * public static $formSubmitButton = "#mainForm input[type=submit]"; | 
				
			||||
	 */ | 
				
			||||
 | 
				
			||||
	/** | 
				
			||||
	 * Basic route example for your current URL | 
				
			||||
	 * You can append any additional parameter to URL | 
				
			||||
	 * and use it in tests like: EditPage::route('/123-post'); | 
				
			||||
	 */ | 
				
			||||
	public static function route($param) | 
				
			||||
	{ | 
				
			||||
		return static::$URL.$param; | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	/** | 
				
			||||
	 * @var | 
				
			||||
	 */ | 
				
			||||
	protected $guy; | 
				
			||||
 | 
				
			||||
	public function __construct($I) | 
				
			||||
	{ | 
				
			||||
		$this->guy = $I; | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	/** | 
				
			||||
	 * @return $this | 
				
			||||
	 */ | 
				
			||||
	public static function of($I) | 
				
			||||
	{ | 
				
			||||
		return new static($I); | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
} | 
				
			||||
					Loading…
					
					
				
		Reference in new issue