protected function setUpMocks() { $this->decipher_mock = TestFactory::mockDecipherDocBlock(); $this->decipher_mock->shouldReceive('process')->withAnyArgs()->andReturn('Results from DecipherDocBlock'); $this->reflection_mock = TestFactory::mockReflectionClass(); $this->reflection_mock->shouldReceive('getMethods')->withAnyArgs()->andReturn([TestFactory::makeClass(['class' => 'Some\\Namespace\\SomeClass', 'name' => '__constructor'], ['getDocComment' => '/** Comment */']), TestFactory::makeClass(['class' => 'Some\\Namespace\\SomeClass', 'name' => 'MethodOne'], ['getDocComment' => '/** Comment */']), TestFactory::makeClass(['class' => 'Some\\Namespace\\ParentClass', 'name' => 'BaseMethod'], ['getDocComment' => '/** Comment */'])]); $this->reflection_mock->shouldReceive('getShortName')->withNoArgs()->andReturn('SomeClass'); $this->reflector_mock = TestFactory::mockClassReflector(); $this->reflector_mock->shouldReceive('reflect')->withAnyArgs()->andReturn($this->reflection_mock); $this->class_name_getter_mock = TestFactory::mockGetClassName(); }
/** * @test */ public function it_processes_classes_that_end_with_Result() { $response = TestFactory::makeClass([], ['getPropertyResult' => 'value']); $this->getter_mock->shouldReceive('process')->with($response)->andReturn(['getPropertyResult'])->once(); $this->assertEquals('value', $this->converter->process($response)); }