Skip to content

Commit

Permalink
Merge pull request #8 from silverstripe-labs/pulls/avoid-hamcrest-glo…
Browse files Browse the repository at this point in the history
…bals

Include Hamcrest without clashing with PHPUnit globals
  • Loading branch information
Damian Mooyman committed May 27, 2015
2 parents a35241c + 38659ba commit b219ebb
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tests/ExternalLinksTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

if (class_exists('Phockito')) Phockito::include_hamcrest();

class ExternalLinksTest extends SapphireTest {

protected static $fixture_file = 'ExternalLinksTest.yml';
Expand All @@ -10,6 +8,14 @@ class ExternalLinksTest extends SapphireTest {
'ExternalLinksTest_Page'
);

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

parent::setUpOnce();
}

public function setUp() {
parent::setUp();

Expand Down Expand Up @@ -60,7 +66,7 @@ public function setUp() {
->return(null);

Phockito::when($checker)
->checkLink(anything()) // anything else is 404
->checkLink(Hamcrest_Matchers::anything()) // anything else is 404
->return(404);

Injector::inst()->registerService($checker, 'LinkChecker');
Expand Down

0 comments on commit b219ebb

Please sign in to comment.