PHP code example of ssaweb / phpunit-slot

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

    

ssaweb / phpunit-slot example snippets


$mock
    ->expects($this->once())
    ->method('foo')
    ->with(self::callback(function ($value): bool {
        self::assertEquals('value', $value);
        return true;
    }))

$slot = new Slot();

$mock
    ->expects($this->once())
    ->method('foo')
    ->with($slot->capture())

//other mock declarations

//then
self::assertEquals(1, $slot->captured);

$slot = new Slot();

$mock
    ->expects($this->any())
    ->method('foo')
    ->with($slot->capture())

//other mock declarations

//then
self::assertEquals(1, $slot->captured[0]);
self::assertEquals(2, $slot->captured[1]);