Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:daylerees/scientist into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Dayle Rees committed Mar 14, 2018
2 parents d011d85 + 357055f commit 5068867
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 16 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"ircmaxell/random-lib": "^1.2"
},
"require-dev": {
"phpunit/phpunit": ">=4.8",
"phpunit/phpunit": "^6.0",
"squizlabs/php_codesniffer": "^2.5",
"jakub-onderka/php-parallel-lint": "^0.9.2",
"phing/phing": "^2.13"
Expand Down
4 changes: 2 additions & 2 deletions src/Machine.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Scientist;

use Exception;
use Throwable;

/**
* Class Executor
Expand Down Expand Up @@ -102,7 +102,7 @@ protected function executeMutedCallback()
{
try {
$this->result->setValue(call_user_func_array($this->callback, $this->params));
} catch (Exception $exception) {
} catch (Throwable $exception) {
$this->result->setException($exception);
$this->result->setValue(null);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Chances/StandardChanceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

use RandomLib\Generator;

class StandardChanceTest extends \PHPUnit_Framework_TestCase
class StandardChanceTest extends \PHPUnit\Framework\TestCase
{
/**
* @var StandardChance
Expand Down
4 changes: 2 additions & 2 deletions tests/ExperimentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Scientist\Laboratory;
use Scientist\Matchers\StandardMatcher;

class ExperimentTest extends PHPUnit_Framework_TestCase
class ExperimentTest extends \PHPUnit\Framework\TestCase
{
public function test_that_a_new_experiment_can_be_created()
{
Expand Down Expand Up @@ -63,7 +63,7 @@ public function test_that_multiple_trial_callbacks_can_be_defined()

public function test_that_a_chance_variable_can_be_set()
{
$chance = $this->getMock('\Scientist\Chances\Chance');
$chance = $this->createMock('\Scientist\Chances\Chance');
$e = new Experiment('test experiment', new Laboratory);
$e->chance($chance);
$this->assertEquals($chance, $e->getChance());
Expand Down
2 changes: 1 addition & 1 deletion tests/InternTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Scientist\Experiment;
use Scientist\Laboratory;

class InternTest extends PHPUnit_Framework_TestCase
class InternTest extends \PHPUnit\Framework\TestCase
{
public function test_that_intern_can_be_created()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Journals/JournalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Scientist\Experiment;
use Scientist\Journals\StandardJournal;

class JournalTest extends PHPUnit_Framework_TestCase
class JournalTest extends \PHPUnit\Framework\TestCase
{
public function test_that_journals_can_be_created()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/LaboratoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use Scientist\Report;
use Scientist\Laboratory;

class LaboratoryTest extends PHPUnit_Framework_TestCase
class LaboratoryTest extends \PHPUnit\Framework\TestCase
{
public function test_laboratory_can_be_created()
{
Expand Down
17 changes: 14 additions & 3 deletions tests/MachineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use Scientist\Result;
use Scientist\Machine;

class MachineTest extends PHPUnit_Framework_TestCase
class MachineTest extends \PHPUnit\Framework\TestCase
{
public function test_that_machine_can_be_created()
{
Expand Down Expand Up @@ -52,9 +52,20 @@ public function test_that_exceptions_can_be_thrown_by_machine_callback_execution
$m->execute();
}

public function test_that_machine_can_mute_exceptions_from_callback()
public static function getErrorData()
{
$m = new Machine(function () { throw new Exception('foo'); }, [], true);
return [
[new Exception()],
[new Error()],
];
}

/**
* @dataProvider getErrorData
*/
public function test_that_machine_can_mute_exceptions_from_callback($exception)
{
$m = new Machine(function () use ($exception) { throw $exception; }, [], true);

$this->assertEquals(null, $m->execute()->getValue());
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Matchers/ClosureMatcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use Scientist\Matchers\ClosureMatcher;

class ClosureMatcherTest extends PHPUnit_Framework_TestCase
class ClosureMatcherTest extends \PHPUnit\Framework\TestCase
{
private function getClosure()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Matchers/StandardMatcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use Scientist\Matchers\StandardMatcher;

class StandardMatcherTest extends PHPUnit_Framework_TestCase
class StandardMatcherTest extends \PHPUnit\Framework\TestCase
{
public function test_that_standard_matcher_can_be_created()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/ReportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use Scientist\Result;
use Scientist\Report;

class ReportTest extends PHPUnit_Framework_TestCase
class ReportTest extends \PHPUnit\Framework\TestCase
{
public function test_that_report_can_be_created()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/ResultTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use Scientist\Result;

class ResultTest extends PHPUnit_Framework_TestCase
class ResultTest extends \PHPUnit\Framework\TestCase
{
public function test_result_can_be_created()
{
Expand Down

0 comments on commit 5068867

Please sign in to comment.