Pull merge.
[yaffs-website] / vendor / jcalderonzumba / gastonjs / tests / unit / BrowserCommandsTestCase.php
1 <?php
2
3 namespace Zumba\GastonJS\Tests;
4
5 use Zumba\GastonJS\Browser\Browser;
6
7 /**
8  * Class BrowserCommandsTestCase
9  * @package Zumba\GastonJS\Tests
10  */
11 class BrowserCommandsTestCase extends \PHPUnit_Framework_TestCase {
12
13   const LOCAL_SERVER_HOSTNAME = "127.0.0.1";
14   const LOCAL_SERVER_PORT = 6789;
15
16   /** @var  Browser */
17   protected $browser;
18   /** @var  string */
19   protected $testPageBaseUrl;
20
21   protected function setUp() {
22     $this->browser = new Browser("http://127.0.0.1:8510/");
23     $this->browser->reset();
24     $this->testPageBaseUrl = sprintf("http://%s:%d", BrowserCommandsTestCase::LOCAL_SERVER_HOSTNAME, BrowserCommandsTestCase::LOCAL_SERVER_PORT);
25   }
26
27   /**
28    * Helper to visit a specific url
29    * @param string $url
30    */
31   protected function visitUrl($url) {
32     $this->assertNotEmpty($url);
33     $cmdResponse = $this->browser->visit($url);
34     $this->assertTrue(is_array($cmdResponse), true);
35     $this->assertEquals("success", $cmdResponse["status"]);
36   }
37
38   /**
39    * @return string
40    */
41   public function getTestPageBaseUrl() {
42     return $this->testPageBaseUrl;
43   }
44
45 }