/** * @covers Box\TestScribe\Utils\ValueTransformer::translateObjectsAndResourceToString * @covers Box\TestScribe\Utils\ValueTransformer */ public function test_mock_object() { // Execute the method under test. $inputHistoryDataMock = MockObjectFactoryForTest::getInputHistoryDataMockInstance(); $objectUnderTest = new \Box\TestScribe\Utils\ValueTransformer(); $executionResult = $objectUnderTest->translateObjectsAndResourceToString($inputHistoryDataMock); // Validate the execution result. $expected = 'mock object ( mockInputHistoryData )'; $this->assertSame($expected, $executionResult, 'Variable ( executionResult ) doesn\'t have the expected value.'); }
/** * @covers Box\TestScribe\Execution\ExecutionResult::jsonSerialize * @covers Box\TestScribe\Execution\ExecutionResult */ public function testJsonSerialize_mockclass_exception() { // Execute the method under test. // Setup mocks for parameters to the constructor. $mockClass = MockObjectFactoryForTest::getInputHistoryDataMockClass(); $constructorArgs = new Arguments([]); $inputValue = InputValueFactoryForTest::createValue('2'); $methodArgs = new Arguments([$inputValue]); $objectUnderTest = new ExecutionResult($constructorArgs, $methodArgs, $mockClass, 1, new \Exception('test exception')); $executionResult = $objectUnderTest->jsonSerialize(); // Validate the execution result. $expected = ['constructorArguments' => "[]", 'methodArguments' => '["2"]', 'mockClassUnderTest' => '"mock object ( mockInputHistoryData )"', 'resultValue' => 1, 'exception' => "Exception (Exception) Msg ( test exception )"]; $this->assertSame($expected, $executionResult); }