PHP code example of thanos-kontos / amock

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

    

thanos-kontos / amock example snippets


$config = new \Amock\Configuration('yaml', 'dir', '/path/to/mock_fixtures');
$this->amock = \Amock\Amock::create($config, $testCase);

$config = new \Amock\Configuration('yaml', 'file', '/path/to/mock_fixtures/somefile.yml');
$this->amock = \Amock\Amock::create($config, $testCase);

$stub = $this->amock->get('mock404Response');
yaml
# tests/mock_fixtures/repositories.yml

MyProject\Library\UserRepository:
  mockUserRepository:
    disableConstructor: true
    mockMethods:
      insert: '@null'
      update: '@null'
MyProject\Library\ProductRepository:
  mockProductRepository:
    disableConstructor: true
    mockMethods:
      insert: '@null'
      update: '@null'