PHP code example of spinen / spinen-php-web-tester

1. Go to this page and download the library: Download spinen/spinen-php-web-tester 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/ */

    

spinen / spinen-php-web-tester example snippets




use Spinen\SimplePhpTester\TestCase;

class HomeTest extends TestCase
{
    /**
     * @test
     */
    public function it_loads_the_home_page()
    {
        $this->visit('/') // Could have used $this->visit('/index.php')
             ->assertPageLoaded();
    }
    
    /**
     * @test
     */
    public function it_has_the_expected_title_in_an_h1()
    {
        $this->visit('/')
             ->see('<h1>Some title</h1>');
    }
    
    /**
     * @test
     */
    public function it_has_the_the_correct_navigation_links()
    {
        $this->visit('/')
             ->seeLink('Home')
             ->seeLink('About Us')
             ->seeLink('Services')
             ->seeLink('Contact')
             ->dontSeeLink('Profile');
    }
}

composer