PHP code example of kanel / phpspec-data-provider-extension
1. Go to this page and download the library: Download kanel/phpspec-data-provider-extension 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/ */
kanel / phpspec-data-provider-extension example snippets
namespace spec\Kanel\PhpSpec\Test;
use Kanel\PhpSpec\Test\Increment;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
class IncrementSpec extends ObjectBehavior
{
/**
* Example of a dataprovider with default values
* @dataProvider getTestSuite
*/
public function it_should_be_able_to_increment_values($input, $output = 1)
{
$this->plusOne($input)->shouldBe($output);
}
public function getTestSuite() {
return [
[0],
[1, 2],
[3, 4],
[5, 6],
];
}
}
namespace Kanel\PhpSpec\Test;
class Increment
{
public function plusOne(int $i): int {
return $i + 1;
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.