PHP code example of get-skipper / skipper-php

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

    

get-skipper / skipper-php example snippets



// tests/Pest.php

use GetSkipper\Core\Config\SkipperConfig;
use GetSkipper\Core\Credentials\Base64Credentials;
use GetSkipper\Core\Credentials\FileCredentials;
use GetSkipper\Pest\Plugin;

// Choose one credentials option:
Plugin::skipperSetup(new SkipperConfig(
    spreadsheetId: 'YOUR_SPREADSHEET_ID',
    credentials: new FileCredentials('./service-account.json'),
    // credentials: new Base64Credentials('eyJ0eXBlIjoic2VydmljZV9hY2NvdW50Ii4uLn0='),
    // credentials: new Base64Credentials((string) getenv('GOOGLE_CREDS_B64')),
    sheetName: 'MySheet', // optional
));


// kahlan-config.php

use GetSkipper\Core\Config\SkipperConfig;
use GetSkipper\Core\Credentials\Base64Credentials;
use GetSkipper\Core\Credentials\FileCredentials;
use GetSkipper\Kahlan\SkipperPlugin;

$config->beforeAll(function () {
    // Choose one credentials option:
    SkipperPlugin::setup(new SkipperConfig(
        spreadsheetId: 'YOUR_SPREADSHEET_ID',
        credentials: new FileCredentials('./service-account.json'),
        // credentials: new Base64Credentials('eyJ0eXBlIjoic2VydmljZV9hY2NvdW50Ii4uLn0='),
        // credentials: new Base64Credentials((string) getenv('GOOGLE_CREDS_B64')),
        sheetName: 'MySheet', // optional
    ));
});

// Check tests globally (all specs in all directories):
$config->scope()->beforeEach(function () {
    SkipperPlugin::checkTest($this);
});

tests/Unit/AuthTest.php > AuthTest > testItCanLogin
tests/Unit/AuthTest.php > AuthTest > testWithDataProvider with data set "valid"

tests/Feature/auth.php > can login
tests/Feature/auth.php > Auth > can login      ← with describe() block

tests/Acceptance/AuthCest.php > AuthCest > tryToLogin
tests/Unit/AuthTest.php > AuthTest > testItCanLogin

spec/Auth/LoginSpec.php > LoginSpec > it login with valid credentials
spec/Auth/LoginSpec.php > LoginSpec > it reject invalid passwords

spec/Auth/LoginSpec.php > Auth > Login > can login with valid credentials