Pull merge.
[yaffs-website] / vendor / jcalderonzumba / gastonjs / tests / unit / BrowserAuthenticationTest.php
1 <?php
2
3 namespace Zumba\GastonJS\Tests;
4
5 /**
6  * Class BrowserAuthenticationTest
7  * @package Zumba\GastonJS\Tests\Server
8  */
9 class BrowserAuthenticationTest extends BrowserCommandsTestCase {
10
11   public function testAuthenticationFails() {
12     $this->visitUrl($this->getTestPageBaseUrl() . "/basic-auth-required/");
13     $this->assertEquals(401, $this->browser->getStatusCode());
14     $this->assertContains("NOT_AUTHORIZED", $this->browser->getBody());
15   }
16
17   public function testAuthenticationSuccess() {
18     $this->browser->setHttpAuth("test", "test");
19     $this->visitUrl($this->getTestPageBaseUrl() . "/basic-auth-required/");
20     $this->assertEquals(200, $this->browser->getStatusCode());
21     $this->assertContains("AUTHORIZATION_OK", $this->browser->getBody());
22   }
23 }