PHP code example of pstephan1187 / laravel-jtest

1. Go to this page and download the library: Download pstephan1187/laravel-jtest 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/ */

    

pstephan1187 / laravel-jtest example snippets




use JTest\JTestCase;

class MyTestClass extends JTestCase
{
	protected $baseUrl = 'http://localhost:8888';

	//...
}

public function testUserCanLogin()
{
	$this->visit('/')
	     ->click('Login')
	     ->seePageIs('/auth/login')
	     ->type('[email protected]', '#email')
	     ->type('user_p@ssw0rd', '#password')
	     ->press('form#login input[type=submit]')
	     ->seePageIs('/dashboard');
}

$this->element('h1', function($element){
	$element->findElement('button')->click()
});