1. Go to this page and download the library: Download toast/acceptance 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/ */
toast / acceptance example snippets
/** Example browser test */
return function () : Generator {
/** We can grab an external page */
yield function () {
$browser = new Toast\Acceptance\Browser;
$page = $browser->get('http://example.com');
$ev
assert($browser->get('http://example.com/')->getStatus() == 200);
};
};
// ...
$john = new Browser('chrome', 1);
$mary = new Browser('chrome', 2);
// Here you would first make sure both users are logged in; how that mechanism
// works exactly is up to your application of course.
// John sends his message
$johnPage = $john->post('/message/', 'form', ['to' => 'Mary', 'body' => 'Hi Mary!']);
// Mary opens the message page
$maryPage = $mary->get('/message/');
assert(strpos($maryPage->evaluate("document.querySelector('body').innerHTML")->getReturnValue(), 'Unread: 1') !== false);
// Empty mock database, so this message got ID 1
$maryPage = $mary->get('/message/1/');
assert(strpos($maryPage->evaluate("document.querySelector('body').innerHTML")->getReturnValue(), 'From: John') !== false);
// Mary read it, so now unread should be 0 again
$maryPage = $mary->get('/message/');
assert(strpos($maryPage->evaluate("document.querySelector('body').innerHTML")->getReturnValue(), 'Unread: 0') !== false);
// And finally John would see the message was read:
$johnPage = $john->get('/message/1/');
assert(strpos($johnPage->evaluate("document.querySelector('body').innerHTML")->getReturnValue(), 'Status: read') !== false);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.