PHP code example of snicco / testing-bundle

1. Go to this page and download the library: Download snicco/testing-bundle 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/ */

    

snicco / testing-bundle example snippets


use Snicco\Bundle\Testing\Functional\Browser;
use Snicco\Bundle\Testing\Functional\WebTestCase;

class SomeTest extends WebTestCase {

    protected function extensions() : array{
        return []; // Return an array of class names implementing TestExtension 
    }
    
    protected function createKernel(){
        return '/path/to/kernel-bootstrap.php' // Path to kernel bootstrap file (assuming this file returns a closure).
    }
    
    public function testHomePage(){
        
        /** @var Browser $browser */
        $browser = $this->getBrowser();
              
        $browser->request('/');
                
        $browser->lastResponse()
                ->assertOk()
                ->assertSeeText('Some text');
                
        $browser->lastDOM()->assertSelectorExists('body > h1');
        
        $browser->reload();
        
        $browser->back();
        
    }    
}
shell
composer install snicco/testing-bundle