1. Go to this page and download the library: Download xp-framework/webtest library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
xp-framework / webtest example snippets
use unittest\web\{WebTestCase, Webtest};
use unittest\Test;
#[Webtest(url: 'https://github.com/')]
class GitHubTestCase extends WebTestCase {
#[Test]
public function home() {
$this->beginAt('/');
$this->assertStatus(200);
$this->assertTitleEquals('GitHub: Where the world builds software · GitHub');
}
}
public void assertStatus(int $status)
public void assertUrlEquals(peer.URL $url)
public void assertContentType(string $ctype)
public void assertHeader(string $header, string $value)
public void assertElementPresent(string $id)
public void assertTextPresent(string $text)
public void assertImagePresent(string $src)
public void assertLinkPresent(string $url)
public void assertLinkPresentWithText(string $text)
public void assertFormPresent(string $name= null)
public void assertTitleEquals($title)