Source of file InputControllerTest.php
Size: 2,336 Bytes - Last Modified: 2021-12-24T06:51:34+00:00
/var/www/docs.ssmods.com/process/src/tests/Controller/InputControllerTest.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 | <?php namespace Heystack\Ecommerce\Controller; class InputControllerTest extends \PHPUnit_Framework_TestCase { /** * @covers \Heystack\Ecommerce\Controller\InputController::__construct */ public function testCanConstructObjectWithValidArguments() { $this->assertTrue( is_object( $controller = new InputController( $this->getMock('Heystack\Core\Input\Handler'), $this->getMock('Heystack\Core\Output\Handler') ) ) ); return $controller; } /** * @covers \Heystack\Ecommerce\Controller\InputController::getInputHandler * @depends testCanConstructObjectWithValidArguments */ public function testCanGetInputHandler($c) { $this->assertEquals( $this->readAttribute($c, 'inputHandler'), $c->getInputHandler() ); } /** * @covers \Heystack\Ecommerce\Controller\InputController::getOutputHandler * @depends testCanConstructObjectWithValidArguments */ public function testCanGetOutputHandler($c) { $this->assertEquals( $this->readAttribute($c, 'outputHandler'), $c->getOutputHandler() ); } /** * @covers \Heystack\Ecommerce\Controller\InputController::__construct */ public function testProcessDoesProduceExpectedOutput() { $controller = new InputController( $inputMock = $this->getMock('Heystack\Core\Input\Handler'), $outptuMock = $this->getMock('Heystack\Core\Output\Handler') ); $request = new \SS_HTTPRequest( 'GET', '/input/process/test/' ); $inputMock->expects($this->once()) ->method('process') ->with('test', $request) ->will($this->returnValue(['success' => true])); $outptuMock->expects($this->once()) ->method('process') ->with('test', $controller, ['success' => true]) ->will($this->returnValue('yay')); $response = $controller->handleRequest( $request, \DataModel::inst() ); $this->assertEquals( 'yay', $response->getBody() ); } } |