/home/mip/mip/public/img/credit/datatables/starship.tar
Bootstrap.php000066400000000310151520661740007235 0ustar00<?php

set_include_path(
    dirname(__FILE__) . '/../../library'
    . PATH_SEPARATOR . get_include_path()
);

require_once 'Mockery/Loader.php';

$loader = new \Mockery\Loader;
$loader->register();
phpunit.xml000066400000000501151520661740006762 0ustar00<phpunit bootstrap="./Bootstrap.php">
    <testsuite name="Starship Test Suite">
        <directory>./</directory>
    </testsuite>
    <listeners>
        <listener class="\Mockery\Adapter\Phpunit\TestListener"
            file="Mockery/Adapter/Phpunit/TestListener.php">
        </listener>
    </listeners>
</phpunit>
StarshipTest.php000066400000001317151520661740007725 0ustar00<?php

use \Mockery as M;

require_once 'Starship.php';

class StarshipTest extends PHPUnit_Framework_TestCase
{
    public function testEngineeringResponseToEnteringOrbit()
    {
        $mock = M::mock('Engineering');
        $mock->shouldReceive('disengageWarp')->once()->ordered();
        $mock->shouldReceive('divertPower')->with(0.40, 'sensors')->once()->ordered();
        $mock->shouldReceive('divertPower')->with(0.30, 'auxengines')->once()->ordered();
        $mock->shouldReceive('runDiagnosticLevel')->with(1)->once()->ordered();
        $mock->shouldReceive('runDiagnosticLevel')->with(M::type('int'))->zeroOrMoreTimes();

        $starship = new Starship($mock);
        $starship->enterOrbit();
    }
}
Starship.php000066400000001147151520661740007066 0ustar00<?php

class Starship
{

    protected $_engineering = null;

    public function __construct($engineering)
    {
        $this->_engineering = $engineering;
    }

    public function enterOrbit()
    {
        $this->_engineering->disengageWarp();
        $this->_engineering->runDiagnosticLevel(5);
        $this->_engineering->divertPower(0.40, 'sensors');
        $this->_engineering->divertPower(0.30, 'auxengines');
        $this->_engineering->runDiagnosticLevel(1);

        // We can add more runDiagnosticLevel() calls without failing the test
        // anywhere above since they are unordered.
    }
}