private function setUpMocks()
 {
     $this->files_mock = TestFactory::mockFilesystem();
     $this->request_mock = TestFactory::mockRequest();
     $this->response_mock = TestFactory::mockResponse();
     $this->generator_mock->shouldReceive('apiDirectory')->with(null, false, true)->andReturn('mocked/directory')->once();
 }
 /**
  * Set up the mock to bootstrap the command tests
  */
 protected function setUp()
 {
     $this->generator_mock = TestFactory::mockGenerator();
     $this->process_mock = TestFactory::mockProcess();
     $this->request = new Request($this->generator_mock);
     parent::setUp();
 }
 protected function setUpMocks()
 {
     $this->input_mock = TestFactory::mockInputArray();
     $this->output_mock = TestFactory::mockOutputConsole();
     $this->request_mock = TestFactory::mockRequest();
     $this->response_mock = TestFactory::mockResponse();
 }
 protected function setUpMocks()
 {
     $this->reflector_mock = TestFactory::mockClassReflector();
     $this->files_mock = TestFactory::mockFilesystem();
     $this->class_name_getter_mock = TestFactory::mockGetClassName();
     $this->reflection_class_mock = TestFactory::mockReflectionClass();
     $this->reflection_method_mock = TestFactory::mockReflectionMethod();
 }
 private function setUpMocks()
 {
     $this->extractor_mock = TestFactory::mockExtractSignatures();
     $this->files_mock = TestFactory::mockFilesystem();
     $this->code_formatter_mock = TestFactory::mockFormatCode();
     $this->generator_mock->shouldReceive('apiDirectory')->with(null, false, true)->andReturn('mocked/directory')->once();
     $this->generator_mock->shouldReceive('get')->with('config')->andReturn(['signature_file_name' => 'SignatureFile'])->once();
     $this->generator_mock->shouldReceive('apiDirectory')->with('SignatureFile.php', false, true)->andReturn('mocked/directory/SignatureFile.php')->once();
 }
 private function setUpMocks()
 {
     $this->files_mock = TestFactory::mockFilesystem();
     $this->request_mock = TestFactory::mockRequest();
     $this->response_mock = TestFactory::mockResponse();
     $this->response_mock->shouldReceive('getSuccessful')->withNoArgs()->andReturn(true);
     $this->response_mock->shouldReceive('getResponse')->withNoArgs()->andReturn("Response");
     $this->output_mock->shouldReceive('writeln')->with("<comment>Response</comment>");
     $this->generator_mock->shouldReceive('apiDirectory')->with(null, false, true)->andReturn('mocked/directory')->once();
 }
 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();
 }
 private function setUpMocks()
 {
     $this->signature_builder_mock = TestFactory::mockBuildSignatures();
     $this->files_mock = TestFactory::mockFilesystem();
     $this->type_hinter_mock = TestFactory::mockInsertTypeHints();
     $this->code_formatter_mock = TestFactory::mockFormatCode();
     $this->code_refactor_mock = TestFactory::mockRefactorCode();
     $this->request_mock = TestFactory::mockRequest();
     $this->response_mock = TestFactory::mockResponse();
     $this->wsdl_generator_mock = TestFactory::mockWsdlGenerator();
     $this->generator_mock->shouldReceive('apiDirectory')->with(null, false, true)->andReturn('mocked/directory')->twice();
 }
 private function setUpMocks()
 {
     $this->client_mock = TestFactory::mockClient();
     $this->filter_mock = TestFactory::mockFilter();
     $this->filter_mock->shouldReceive('getOperators')->andReturn(['!=' => 'NotEquals', '<=' => 'LessThanEquals', '>=' => 'GreaterThanEquals', '=' => 'Equals', '<' => 'LessThan', '>' => 'GreaterThan', 'contains' => 'Contains', 'like' => 'Like']);
     foreach (['set', 'orderBy', 'where', 'whereRaw'] as $method) {
         $this->filter_mock->shouldReceive('isCoreMethod')->with($method)->andReturn(true);
     }
     // All others are false
     $this->filter_mock->shouldReceive('isCoreMethod')->withAnyArgs()->andReturn(false);
     //        $this->filter_mock->shouldReceive('orderBy')
     //                          ->andReturnSelf();
     //        $this->filter_mock->shouldReceive('where')
     //                          ->andReturnSelf();
     //        $this->filter_mock->shouldReceive('whereRaw')
     //                          ->andReturnSelf();
 }
 /**
  * @test
  */
 public function it_returns_the_expected_results()
 {
     $expected = ['getArray', 'getObject', 'getString'];
     // Just does not have "get" in it
     $methodThatIsNotAGetter = TestFactory::mockReflectionMethod();
     $methodThatIsNotAGetter->shouldReceive('getName')->withNoArgs()->andReturn('methodThatIsNotAGetter')->once();
     // Has "get" in the middle of the method name
     $forgetMethod = TestFactory::mockReflectionMethod();
     $forgetMethod->shouldReceive('getName')->withNoArgs()->andReturn('forgetMethod')->once();
     // Letter after "get" is not caps
     $getter = TestFactory::mockReflectionMethod();
     $getter->shouldReceive('getName')->withNoArgs()->andReturn('getter')->once();
     $getArray = TestFactory::mockReflectionMethod();
     $getArray->shouldReceive('getName')->withNoArgs()->andReturn('getArray')->once();
     $getObject = TestFactory::mockReflectionMethod();
     $getObject->shouldReceive('getName')->withNoArgs()->andReturn('getObject')->once();
     $getString = TestFactory::mockReflectionMethod();
     $getString->shouldReceive('getName')->withNoArgs()->andReturn('getString')->once();
     $reflection_mock = TestFactory::mockReflectionClass();
     $reflection_mock->shouldReceive('getMethods')->with(ReflectionMethod::IS_PUBLIC)->andReturn([$methodThatIsNotAGetter, $forgetMethod, $getter, $getArray, $getObject, $getString])->once();
     $this->reflecter_mock->shouldReceive('reflect')->with('SomeResultClass')->andReturn($reflection_mock)->once();
     $response = $this->getter->process('SomeResultClass');
     $this->assertEquals($expected, $response);
 }
 /**
  * @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));
 }
 private function setUpMocks()
 {
     $this->client_mock = TestFactory::mockClient();
     $this->validator_mock = TestFactory::mockValidator();
 }
 /**
  * @test
  */
 public function it_returns_the_expected_results_with_single_result()
 {
     $converter_mock = TestFactory::mockConverter();
     $converter_mock->shouldReceive('setApi')->withAnyArgs()->andReturnSelf()->once();
     $converter_mock->shouldReceive('setColumns')->withAnyArgs()->andReturnSelf()->once();
     $converter_mock->shouldReceive('process')->withAnyArgs()->andReturn(1)->once();
     $client = (new Client($this->buildConfig(), $converter_mock))->setApiNamespace('Spinen\\ConnectWise\\Client\\Stubs')->setApi('SomeApi')->setMethod('FunctionCall');
     $this->assertEquals(1, $client->execute(['key' => 'value']));
 }
 /**
  * @test
  */
 public function it_sets_the_loader()
 {
     $loader_mock = TestFactory::mockClassLoader();
     $this->assertEquals($this->generator, $this->generator->setLoader($loader_mock));
     $this->assertInstanceOf('Composer\\Autoload\\ClassLoader', $this->generator->get('loader'));
 }
 private function setUpMocks()
 {
     $this->files_mock = TestFactory::mockFilesystem();
     $this->type_hinter_mock = TestFactory::mockAddTypeHints();
     $this->generator_mock->shouldReceive('apiDirectory')->with(null, false, true)->andReturn('mocked/directory')->once();
 }
 protected function setUp()
 {
     parent::setUp();
     $this->app_mock = TestFactory::mockLaravelApp();
     $this->service_provider = new ServiceProvider($this->app_mock);
 }
 /**
  * Mocks that are needed for all of the command tests
  */
 private function setupMocks()
 {
     $this->generator_mock = TestFactory::mockGenerator();
     $this->input_mock = TestFactory::mockInputArray();
     $this->output_mock = TestFactory::mockOutputConsole();
 }