PHP code example of codekandis / phpunit

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

    

codekandis / phpunit example snippets


class FooTest extends TestCase
{
}

class ImportantStuffDataProvider implements DataProviderInterface
{
  #[Override]
  public static function provideData(): iterable
  {
    return [
      0 => [
        23,
        42
      ],
      1 => [
        'foo',
        'bar'
      ]
    ];
  }
}

 declare( strict_types = 1 );
use CodeKandis\PhpUnit\TestCase;

class FooTest extends TestCase
{
  #[DataProviderExternal( ImportantStuffDataProvider::class, 'provideData' )]
  testImportantStuff( string $value1, string $value2 )
  {
  }
}