PHP code example of darling / php-mocking-utilities

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

    

darling / php-mocking-utilities example snippets


composer 



DIR__ .
    DIRECTORY_SEPARATOR .
    'vendor' .
    DIRECTORY_SEPARATOR .
    'autoload.php'
);

use \Darling\PHPMockingUtilities\classes\mock\values\MockArray;

$mockArray = new MockArray();

var_dump($mockArray->value());

// example output:
array(0) {
}




DIR__ .
    DIRECTORY_SEPARATOR .
    'vendor' .
    DIRECTORY_SEPARATOR .
    'autoload.php'
);

use \Darling\PHPMockingUtilities\classes\mock\values\MockBool;

$mockBool = new MockBool();

var_dump($mockBool->value());

// example output:
bool(false)




DIR__ .
    DIRECTORY_SEPARATOR .
    'vendor' .
    DIRECTORY_SEPARATOR .
    'autoload.php'
);

use \Darling\PHPMockingUtilities\classes\mock\values\MockClosure;

$mockClosure = new MockClosure();

var_dump($mockClosure->value());

// example output:
class Closure#2 (1) {
  virtual $closure =>
  "$this->Darling\PHPMockingUtilities\classes\mock\values\{closure}"
  public $this =>
  class Darling\PHPMockingUtilities\classes\mock\values\MockClosure#3 (0) {
  }
}





DIR__ .
    DIRECTORY_SEPARATOR .
    'vendor' .
    DIRECTORY_SEPARATOR .
    'autoload.php'
);

use \Darling\PHPMockingUtilities\classes\mock\values\MockFloat;

$mockFloat = new MockFloat();

var_dump($mockFloat->value());

// example output:
double(394703.8)




DIR__ .
    DIRECTORY_SEPARATOR .
    'vendor' .
    DIRECTORY_SEPARATOR .
    'autoload.php'
);

use \Darling\PHPMockingUtilities\classes\mock\values\MockInt;

$mockInt = new MockInt();

var_dump($mockInt->value());

// example output:
int(5360127692240532047)




DIR__ .
    DIRECTORY_SEPARATOR .
    'vendor' .
    DIRECTORY_SEPARATOR .
    'autoload.php'
);

use \Darling\PHPMockingUtilities\classes\mock\values\MockString;

$mockString = new MockString();

var_dump($mockString->value());

// example output:

string(49) "MockStringCwnmRNocnGdY2O3TLudxVHbJIZ0EzbJEXKxB743"