当前位置: 首页>>代码示例>>PHP>>正文


PHP App::instance方法代码示例

本文整理汇总了PHP中Illuminate\Support\Facades\App::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP App::instance方法的具体用法?PHP App::instance怎么用?PHP App::instance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Support\Facades\App的用法示例。


在下文中一共展示了App::instance方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testLeadSourceIndex

 public function testLeadSourceIndex()
 {
     // Given
     $mockNumberList = Mockery::mock();
     $mockNumber = Mockery::mock();
     $mockNumber->friendly_name = '(555) 444 444';
     $mockNumber->region = 'Some region';
     $mockNumber->phone_number = '+1555444444';
     $mockNumbers = [$mockNumber];
     $mockNumberList->available_phone_numbers = $mockNumbers;
     $mockTwilio = Mockery::mock('Services_Twilio');
     $mockTwilio->account = Mockery::mock();
     $mockTwilio->account->available_phone_numbers = Mockery::mock();
     $mockTwilio->account->available_phone_numbers->shouldReceive('getList')->with('US', 'Local', ['AreaCode' => null])->andReturn($mockNumberList);
     App::instance('Twilio', $mockTwilio);
     $newLeadSource = new LeadSource(['number' => '+136428733', 'description' => 'Some billboard somewhere', 'forwarding_number' => '+13947283']);
     $newLeadSource->save();
     // When
     $newResponse = $this->call('GET', route('dashboard'));
     // Then
     $newLeadSources = $newResponse->getOriginalContent()['leadSources'];
     $this->assertCount(1, $newLeadSources);
     $this->assertEquals($newLeadSources[0]['number'], '+136428733');
     $this->assertEquals($newLeadSources[0]['description'], 'Some billboard somewhere');
     $this->assertEquals($newLeadSources[0]['forwarding_number'], '+13947283');
 }
开发者ID:TwilioDevEd,项目名称:call-tracking-laravel,代码行数:26,代码来源:LeadControllerTest.php

示例2: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $data = $request->except("_token");
     $data['user']['id'] = 1;
     App::instance(SmsCourierInterface::class, new Mitake_SMS($this->apiKey));
     event(new SendSMSEvent($data));
     $user = User::find($data['user']['id']);
     echo "<pre>";
     return json_encode($user->sms()->get(), JSON_PRETTY_PRINT);
 }
开发者ID:oomusou,项目名称:Laradiner_Decoupling_Handler,代码行数:16,代码来源:SmsController.php

示例3: testIndex

 public function testIndex()
 {
     // Given
     $mockNumber = Mockery::mock();
     $mockNumber->friendlyName = '(555) 444 444';
     $mockNumber->region = 'Some region';
     $mockNumber->phoneNumber = '+1555444444';
     $mockNumbers = [$mockNumber];
     $mockTwilioClient = Mockery::mock(Client::class);
     $mockUsPhones = Mockery::mock();
     $mockTwilioClient->shouldReceive("availablePhoneNumbers")->withAnyArgs("US")->andReturn($mockUsPhones);
     $mockUsPhones->local = Mockery::mock();
     $mockUsPhones->local->shouldReceive('stream')->andReturn($mockNumbers);
     App::instance(Client::class, $mockTwilioClient);
     //Then
     $this->visit(route('available_number.index'))->assertViewHas("numbers", $mockNumbers);
 }
开发者ID:TwilioDevEd,项目名称:call-tracking-laravel,代码行数:17,代码来源:AvailableNumberControllerTest.php

示例4: testDestroy

 public function testDestroy()
 {
     // Given
     Session::start();
     $this->assertCount(0, LeadSource::all());
     $newLeadSource = new LeadSource(['number' => '+136428733', 'description' => 'Some billboard somewhere', 'forwarding_number' => '+13947283']);
     $newLeadSource->save();
     $this->assertCount(1, LeadSource::all());
     $mockNumber = Mockery::mock();
     $mockNumber->sid = 'sup3runiq3s1d';
     $mockTwilioClient = Mockery::mock(Client::class);
     $mockPhoneToDelete = Mockery::mock(IncomingPhoneNumberInstance::class);
     $mockPhoneToDelete->shouldReceive("delete")->once();
     $mockTwilioClient->incomingPhoneNumbers = Mockery::mock(IncomingPhoneNumberList::class);
     $mockTwilioClient->incomingPhoneNumbers->shouldReceive('read')->withAnyArgs()->once()->andReturn([0 => $mockPhoneToDelete]);
     App::instance(Client::class, $mockTwilioClient);
     // When
     $response = $this->call('DELETE', route('lead_source.destroy', [$newLeadSource]), ['_token' => Session::token()]);
     // Then
     $this->assertCount(0, LeadSource::all());
 }
开发者ID:TwilioDevEd,项目名称:call-tracking-laravel,代码行数:21,代码来源:LeadSourceControllerTest.php

示例5: it_show_IfCanBeBoughtByTheCurrentUser

 /**
  * @test
  **/
 public function it_show_IfCanBeBoughtByTheCurrentUser()
 {
     $authenticator = m::mock('StdClass')->shouldReceive("check")->once()->andReturn(true)->shouldReceive('hasGroup')->andReturn(true)->getMock();
     App::instance('authenticator', $authenticator);
     $presenter = new PresenterProducts([]);
     $can_buy = $presenter->canBeBought();
     $this->assertTrue($can_buy);
 }
开发者ID:palmabit,项目名称:catalog,代码行数:11,代码来源:ProductPresenterTest.php

示例6: mockGetTokenWithError

 private function mockGetTokenWithError()
 {
     $mock_auth = m::mock('StdClass')->shouldReceive('getToken')->once()->andThrow(new UserNotFoundException())->getMock();
     App::instance('authenticator', $mock_auth);
 }
开发者ID:tarantinoOD,项目名称:laravel-authentication-acl,代码行数:5,代码来源:ReminderServiceTest.php

示例7: prepareMiddleware

 /**
  * Prepares / Disables route middlewares.
  *
  * @param  bool $disable
  *
  * @return  void
  */
 public function prepareMiddleware($disable = true)
 {
     App::instance('middleware.disable', true);
 }
开发者ID:mpociot,项目名称:laravel-apidoc-generator,代码行数:11,代码来源:LaravelGenerator.php


注:本文中的Illuminate\Support\Facades\App::instance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。