BasePage.php 928 Bytes
Newer Older
1 2 3 4
<?php

namespace yii\codeception;

5 6 7 8 9 10 11 12 13 14 15 16
use Codeception\AbstractGuy;

/**
 *
 * Declare UI map for this page here. CSS or XPath allowed.
 * public static $usernameField = '#username';
 * public static $formSubmitButton = "#mainForm input[type=submit]";
 *
 * @author Mark Jebri <mark.github@yandex.ru>
 * @since 2.0
 */
abstract class BasePage
17
{
18 19 20
	/**
	 * @var string include url of current page. This property has to be overwritten by subclasses
	 */
21 22
	public static $URL = '';
	/**
23
	 * @var AbstractGuy
24
	 */
25 26 27 28 29 30
	protected $guy;

	public function __construct($I)
	{
		$this->guy = $I;
	}
31 32 33 34 35 36 37 38 39 40 41 42

	/**
	 * 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;
	}

	/**
43 44
	 * @param $I
	 * @return static
45 46 47 48 49 50
	 */
	public static function of($I)
	{
		return new static($I);
	}
}