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


PHP Config::shouldReceive方法代码示例

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


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

示例1: setUp

 public function setUp()
 {
     // set up config
     Config::shouldReceive('get')->zeroOrMoreTimes()->with("datatable::engine")->andReturn(array('exactWordSearch' => false));
     $this->collection = new Collection();
     $this->engine = new CollectionEngine($this->collection);
 }
开发者ID:Kangaroos,项目名称:oneshike,代码行数:7,代码来源:BaseEngineTest.php

示例2: testItRunAuditingEnableConsole

 public function testItRunAuditingEnableConsole()
 {
     App::shouldReceive('runningInConsole')->once()->andReturn(true);
     Config::shouldReceive('get')->once()->with('auditing.audit_console')->andReturn(true);
     $model = new AuditableModel();
     $this->assertTrue($model->isAuditEnabled());
 }
开发者ID:owen-it,项目名称:laravel-auditing,代码行数:7,代码来源:AuditableTest.php

示例3: testGetOwner

 public function testGetOwner()
 {
     Config::shouldReceive('get')->once()->with('auth.model')->andReturn('TestUser');
     $stub = m::mock('TestUserTeamTraitStub[hasOne]');
     $stub->shouldReceive('hasOne')->once()->with('User', 'user_id', 'owner_id')->andReturn([]);
     $this->assertEquals([], $stub->owner());
 }
开发者ID:nilsenj,项目名称:itway,代码行数:7,代码来源:TeamworkTeamTraitTest.php

示例4: testRoles

 public function testRoles()
 {
     /*
     |------------------------------------------------------------
     | Set
     |------------------------------------------------------------
     */
     $belongsToMany = new stdClass();
     $user = m::mock('HasRoleUser')->makePartial();
     $app = m::mock('app')->shouldReceive('instance')->getMock();
     $config = m::mock('config');
     Config::setFacadeApplication($app);
     Config::swap($config);
     /*
     |------------------------------------------------------------
     | Expectation
     |------------------------------------------------------------
     */
     $user->shouldReceive('belongsToMany')->with('role_table_name', 'assigned_roles_table_name', 'user_id', 'role_id')->andReturn($belongsToMany)->once();
     Config::shouldReceive('get')->once()->with('entrust.role')->andReturn('role_table_name');
     Config::shouldReceive('get')->once()->with('entrust.role_user_table')->andReturn('assigned_roles_table_name');
     /*
     |------------------------------------------------------------
     | Assertion
     |------------------------------------------------------------
     */
     $this->assertSame($belongsToMany, $user->roles());
 }
开发者ID:ChenYx,项目名称:test,代码行数:28,代码来源:EntrustUserTest.php

示例5: setupBuilder

 protected function setupBuilder($showAllRecords = false)
 {
     Config::shouldReceive('get');
     $cache = m::mock('stdClass');
     $driver = m::mock('stdClass');
     $data = [['id' => 1, 'name' => 'foo'], ['id' => 2, 'name' => 'bar']];
     $builder = m::mock('Illuminate\\Database\\Query\\Builder');
     $builder->shouldReceive('select')->once()->with(['id', 'name'])->andReturn($builder);
     $builder->shouldReceive('from')->once()->with('users')->andReturn($builder);
     $builder->shouldReceive('get')->once()->andReturn($data);
     $builder->columns = ['id', 'name'];
     $builder->select(['id', 'name'])->from('users');
     // ******************************
     // Datatables::of() mocks
     // ******************************
     $builder->shouldReceive('getConnection')->andReturn(m::mock('Illuminate\\Database\\Connection'));
     $builder->shouldReceive('toSql')->times(6)->andReturn('select id, name from users');
     $builder->getConnection()->shouldReceive('raw')->once()->andReturn('select \'1\' as row_count');
     $builder->shouldReceive('select')->once()->andReturn($builder);
     $builder->getConnection()->shouldReceive('raw')->andReturn('(select id, name from users) count_row_table');
     $builder->shouldReceive('select')->once()->andReturn($builder);
     $builder->getConnection()->shouldReceive('table')->times(2)->andReturn($builder);
     $builder->shouldReceive('getBindings')->times(2)->andReturn([]);
     $builder->shouldReceive('setBindings')->times(2)->with([])->andReturn($builder);
     // ******************************
     // Datatables::make() mocks
     // ******************************
     if (!$showAllRecords) {
         $builder->shouldReceive('skip')->once()->andReturn($builder);
         $builder->shouldReceive('take')->once()->andReturn($builder);
     }
     $builder->shouldReceive('count')->times(2)->andReturn(2);
     return $builder;
 }
开发者ID:GHFernando,项目名称:laravel-datatables,代码行数:34,代码来源:TestDatatablesQueryBuilderEngine.php

示例6: setupBuilder

 protected function setupBuilder($showAllRecords = false)
 {
     Config::shouldReceive('get');
     $cache = m::mock('stdClass');
     $driver = m::mock('stdClass');
     $data = [['id' => 1, 'name' => 'foo'], ['id' => 2, 'name' => 'bar']];
     $builder = m::mock('Illuminate\\Database\\Query\\Builder');
     $builder->shouldReceive('getGrammar')->once()->andReturn($builder);
     $builder->shouldReceive('getTablePrefix')->once()->andReturn($builder);
     $builder->shouldReceive('getConnection')->andReturn(m::mock('Illuminate\\Database\\Connection'));
     $builder->getConnection()->shouldReceive('getDriverName')->once()->andReturn('dbdriver');
     // setup builder
     $builder->shouldReceive('select')->once()->with(['id', 'name'])->andReturn($builder);
     $builder->shouldReceive('from')->once()->with('users')->andReturn($builder);
     $builder->columns = ['id', 'name'];
     $builder->select(['id', 'name'])->from('users');
     // count total records
     $builder->shouldReceive('toSql')->times(2)->andReturn('select id, name from users');
     $builder->shouldReceive('select')->once()->andReturn($builder);
     $builder->getConnection()->shouldReceive('raw')->once()->andReturn('select \'1\' as row_count');
     $builder->getConnection()->shouldReceive('table')->once()->andReturn($builder);
     $builder->getConnection()->shouldReceive('raw')->andReturn('(select id, name from users) count_row_table');
     $builder->shouldReceive('toSql')->once()->andReturn('select id, name from users');
     $builder->shouldReceive('getBindings')->once()->andReturn([]);
     $builder->shouldReceive('setBindings')->once()->with([])->andReturn($builder);
     $builder->shouldReceive('count')->once()->andReturn(2);
     // get data
     $builder->shouldReceive('get')->once()->andReturn($data);
     // pagination
     if (!$showAllRecords) {
         $builder->shouldReceive('skip')->once()->andReturn($builder);
         $builder->shouldReceive('take')->once()->andReturn($builder);
     }
     return $builder;
 }
开发者ID:ntamvl,项目名称:laravel-datatables,代码行数:35,代码来源:TestDatatablesQueryBuilderEngine.php

示例7: testGetModelClassFoundation

 public function testGetModelClassFoundation()
 {
     $class = 'C4tech\\Magic';
     Config::shouldReceive('get')->with('upload.models.upload', 'upload.models.upload')->once()->andReturn('C4tech\\Silly');
     Config::shouldReceive('get')->with('foundation.models.upload', 'C4tech\\Silly')->once()->andReturn($class);
     expect($this->repo->getModelClass())->equals($class);
 }
开发者ID:C4Tech,项目名称:laravel-upload,代码行数:7,代码来源:RepositoryTest.php

示例8: it_creates_the_user_relationship

 /**
  * @test
  */
 public function it_creates_the_user_relationship()
 {
     Config::shouldReceive('get')->once()->with('eloquent-sentiment.user')->andReturn('UserClass');
     $sentiment = m::mock(Sentiment::class)->makePartial();
     $sentiment->shouldReceive('belongsTo')->once()->andReturn('ok');
     $this->assertEquals($sentiment->user(), 'ok');
 }
开发者ID:mintbridge,项目名称:eloquent-sentiment,代码行数:10,代码来源:SentimentTest.php

示例9: testToArrayJsonify

 public function testToArrayJsonify()
 {
     $this->model->test_thing = 123;
     $this->model->shouldReceive('convertToCamelCase')->with(['test_thing' => 123])->once()->andReturn(false);
     Config::shouldReceive('get')->with('c4tech.jsonify_output', true)->once()->andReturn(true);
     expect($this->model->toArray())->false();
 }
开发者ID:C4Tech,项目名称:laravel-support,代码行数:7,代码来源:ModelTest.php

示例10: testListenToUploadModelClosure

 public function testListenToUploadModelClosure()
 {
     $model = Mockery::mock('UploadableModel');
     $repository = Mockery::mock('C4tech\\Upload\\Contracts\\UploadInterface');
     $repository->id = 16;
     $tags = ['tags'];
     $upload = Mockery::mock('UploadInstance');
     $uploadable = Mockery::mock('C4tech\\Upload\\Contracts\\UploadableModelInterface');
     $this->repo->shouldReceive('getModelClass')->withNoArgs()->once()->andReturn($model);
     Config::shouldReceive('get')->with('app.debug')->twice()->andReturn(true);
     Log::shouldReceive('debug')->with(Mockery::type('string'), Mockery::type('array'))->twice();
     $model->shouldReceive('updated');
     $model->shouldReceive('deleted');
     Upload::shouldReceive('getModelClass')->withNoArgs()->once()->andReturn($upload);
     $upload->shouldReceive('updated');
     $upload->shouldReceive('deleted')->with(Mockery::on(function ($closure) use($upload) {
         expect_not($closure($upload));
         return true;
     }));
     Upload::shouldReceive('make')->with($upload)->once()->andReturn($repository);
     $repository->shouldReceive('getTags')->with($model)->once()->andReturn($tags);
     Cache::shouldReceive('tags->flush')->with($tags)->withNoArgs()->once();
     $this->repo->shouldReceive('withUpload')->with($repository)->once()->andreturn([$uploadable]);
     $uploadable->shouldReceive('getModel->touch')->withNoArgs()->once();
     expect_not($this->repo->listenToUpload());
 }
开发者ID:C4Tech,项目名称:laravel-upload,代码行数:26,代码来源:RepositoryTraitTest.php

示例11: testPlaceholders

 public function testPlaceholders()
 {
     $this->specify("placeholders are replaced with values of other validated fields", function () {
         $rules = ['a' => 'min:{{min}}'];
         $data = ['a' => 'abcd', 'min' => 3];
         $this->assertTrue($this->makeValidator($rules, $data)->passes());
         $data = ['a' => 'ab', 'min' => 3];
         $this->assertFalse($this->makeValidator($rules, $data)->passes());
         $rules = ['a' => '!min:{{min}}'];
         $data = ['a' => 'abcd', 'min' => 3];
         $this->assertFalse($this->makeValidator($rules, $data)->passes());
         $data = ['a' => 'ab', 'min' => 3];
         $this->assertTrue($this->makeValidator($rules, $data)->passes());
     });
     $this->specify("placeholders are replaced with config values", function () {
         Config::shouldReceive('get')->with('app.min')->andReturn(3);
         $rules = ['a' => 'min:{{app.min}}'];
         $data = ['a' => 'abcd'];
         $this->assertTrue($this->makeValidator($rules, $data)->passes());
         $data = ['a' => 'ab'];
         $this->assertFalse($this->makeValidator($rules, $data)->passes());
         $rules = ['a' => '!min:{{app.min}}'];
         $data = ['a' => 'abcd'];
         $this->assertFalse($this->makeValidator($rules, $data)->passes());
         $data = ['a' => 'ab'];
         $this->assertTrue($this->makeValidator($rules, $data)->passes());
     });
 }
开发者ID:jedrzej,项目名称:validator-extended-syntax,代码行数:28,代码来源:ValidationTest.php

示例12: testTrueSecureURL

 /**
  * Test if a key is return if useSecureURLs is configured true
  */
 public function testTrueSecureURL()
 {
     $expectedResult = 'my-key';
     $glideConfig['useSecureURLs'] = true;
     Config::shouldReceive('get')->with('app.key')->andReturn($expectedResult);
     $result = $this->serviceProvider->getSignKey($glideConfig);
     $this->assertEquals($expectedResult, $result);
 }
开发者ID:enpina,项目名称:laravel-glide,代码行数:11,代码来源:SignKeyTest.php

示例13: setUp

 protected function setUp()
 {
     // set up config
     Config::shouldReceive('get')->zeroOrMoreTimes()->with("chumper_datatable.engine")->andReturn(array('exactWordSearch' => false));
     Config::shouldReceive('get')->zeroOrMoreTimes()->with("chumper_datatable.table")->andReturn(array('class' => 'table table-bordered', 'id' => '', 'options' => array("sPaginationType" => "full_numbers", "bProcessing" => false), 'callbacks' => array(), 'noScript' => false, 'table_view' => 'datatable::template', 'script_view' => 'datatable::javascript'));
     $this->dt = new Datatable();
     $this->mock = Mockery::mock('Illuminate\\Database\\Query\\Builder');
 }
开发者ID:Cyber-Duck,项目名称:Datatable,代码行数:8,代码来源:DatatableTest.php

示例14: it_generates_not_rewrite_url_if_config_value_is_false

 /** @test */
 public function it_generates_not_rewrite_url_if_config_value_is_false()
 {
     Config::shouldReceive('get')->once()->with("imgproxy::rewrite")->andReturn(false);
     URL::shouldReceive('to')->once()->with("packages/spescina/imgproxy/timthumb.php?w=100&h=70&zc=1&q=90&src=image/path/url.jpg")->andReturn("http://www.example.com/packages/spescina/imgproxy/timthumb.php?w=100&h=70&zc=1&q=90&src=image/path/url.jpg");
     $imgProxy = new Imgproxy();
     $url = $imgProxy->link("image/path/url.jpg", 100, 70);
     $this->assertEquals("http://www.example.com/packages/spescina/imgproxy/timthumb.php?w=100&h=70&zc=1&q=90&src=image/path/url.jpg", $url);
 }
开发者ID:spescina,项目名称:imgproxy,代码行数:9,代码来源:ImgproxyTest.php

示例15: testGetApiPrefix

 public function testGetApiPrefix()
 {
     Config::shouldReceive('get')->with('andizzle/rest-framework::deprecated')->andReturn(array());
     Config::shouldReceive('get')->with('andizzle/rest-framework::version')->andReturn('v1');
     Request::shouldReceive('segments')->once()->andReturn(array('api', 'v1', 'test'));
     $server = new RestServer();
     $this->assertEquals($server->getApiPrefix(), '/api/v1');
 }
开发者ID:andizzle,项目名称:rest-framework,代码行数:8,代码来源:RestServerTest.php


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