PHP code example of aaronhipple / sampler

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

    

aaronhipple / sampler example snippets


use AaronHipple\Sampler\AbstractSampleTestCase;

class SampleTest extends AbstractSampleTestCase
{
    /**
     * Provide absolute paths to the directories to scan for samples.
     * 
     * @return []string An array of folder paths.
     */
    protected function paths() 
    {
        return [__DIR__ . '/../src'];
    }
   
    /**
     * (Optional) Provide a list of file extensions to scan.
     */
    protected function extensions() 
    {
        return ['php', 'inc'];
    }
}

/**
 * Say hello to someone!
 *
 * @sample
 *   use PHPUnit\Framework\Assert;
 *   Assert::assertInternalType(
 *     'string',
 *     say_hello('Frank')
 *   );
 * @sample
 *   use PHPUnit\Framework\Assert;
 *   Assert::assertEquals(
 *     'Hello, Aaron!',
 *     say_hello('Aaron')
 *   );
 */
function say_hello($name) {
  return "Hello, $name!";
}

/**
 * Say hello to someone!
 *
 * # Examples
 *
 * 

 */
function say_hello($name) {
  return "Hello, $name!";
}