2017 © Pedro Peláez
 

silverstripe-module silverstripe-phockito

Integrate Phockito (a PHP Mocking framework) with SilverStripe

image

hafriedlander/silverstripe-phockito

Integrate Phockito (a PHP Mocking framework) with SilverStripe

  • Friday, June 5, 2015
  • by hafriedlander
  • Repository
  • 1 Watchers
  • 4 Stars
  • 24,104 Installations
  • PHP
  • 6 Dependents
  • 0 Suggesters
  • 7 Forks
  • 6 Open issues
  • 2 Versions
  • 6 % Grown

The README.md

Phockito integration module for SilverStripe

Phockito generates subclasses of the class under mock or spy. This doesn't work well with SilverStripe, which builds a manifest of classes and expects them to remain static during execution., (*1)

This module provides integration between SilverStripe and Phockito, so that every time you create a mock or spy with Phockito, it's registered in SilverStripe's ClassManifest., (*2)

This all happens automatically, so you don't have to worry about it - just add this module to your composer.json, then start calling Phocktio::mock or Phockito::spy in your tests., (*3)

If you're calling Phockito::include_hamcrest() to use Hamcrest matchers like anything(), please remember to limit the inclusion to the test execution by placing it in setUpOnce(). Placing it outside of the class scope and executing the include calls when then PHP file is first included by PHP can cause clashes with PHPUnit's built-in matchers. To further avoid clashes, you should also avoid including these matchers yourself (PHPUnit\Framework\Assert\Functions.php)., (*4)

<?php
class MyTest extends SapphireTest {

    public function setUpOnce() {
        if (class_exists('Phockito')) {
            Phockito::include_hamcrest();
        }

        parent::setUpOnce();
    }

}

The Versions

05/06 2015

dev-master

9999999-dev

Integrate Phockito (a PHP Mocking framework) with SilverStripe

  Sources   Download

BSD-3-Clause

The Requires

 

by Hamish Friedlander

testing mocks mockito

24/10 2013

1.0.0

1.0.0.0

Integrate Phockito (a PHP Mocking framework) with SilverStripe

  Sources   Download

BSD-3-Clause

The Requires

 

by Hamish Friedlander

testing mocks mockito