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


PHP Cache::shouldReceive方法代码示例

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


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

示例1: testGetLeaves

 public function testGetLeaves()
 {
     $this->repo->shouldReceive('formatTag')->with('leaves')->once()->andReturn('tag');
     $this->repo->shouldReceive('getCacheId')->with('leaves')->once()->andReturn('hashid');
     Cache::shouldReceive('tags->remember')->with(Mockery::type('string'))->with(Mockery::type('string'), Mockery::type('integer'), Mockery::on(function ($closure) {
         $this->repo->shouldReceive('leaves->get')->withNoArgs()->once()->andReturn(false);
         expect($closure())->false();
         return true;
     }))->once()->andReturn(true);
     expect($this->repo->getLeaves())->true();
 }
开发者ID:C4Tech,项目名称:laravel-nested-sets,代码行数:11,代码来源:RepositoryTest.php

示例2: testMarkRead

 public function testMarkRead()
 {
     $entry = $this->logReader->get()->first();
     Cache::shouldReceive('rememberForever')->once()->andReturn($entry);
     $this->assertEquals($entry, $entry->markRead());
 }
开发者ID:stevebauman,项目名称:log-reader,代码行数:6,代码来源:LogReaderTest.php

示例3: testUpdate

 public function testUpdate()
 {
     $this->mockFind(1);
     Config::shouldReceive('get')->once()->with('wardrobe.cache')->andReturn(true);
     $this->post->shouldReceive('getAttribute')->andReturn(1);
     Cache::shouldReceive('forget')->once()->with('post-1')->andReturn(Mockery::self());
     $this->post->shouldReceive('fill')->once()->andReturn($this->post)->shouldReceive('save')->once()->withNoArgs()->andReturn($this->post);
     $this->post->shouldReceive('tags')->once()->withNoArgs()->andReturn($this->post)->shouldReceive('delete')->once()->withNoArgs()->andReturn($this->post);
     $this->post->shouldReceive('tags')->once()->withNoArgs()->andReturn($this->post)->shouldReceive('createMany')->once()->andReturn($this->post);
     $returned = $this->DbPostRepository()->update(array('id' => 1, 'title' => 'Wardrobe', 'content' => 'foo bar', 'active' => 1, 'user_id' => 1, 'publish_date' => new Carbon(), 'tags' => array('wardrobe', 'cabinet')));
     $this->assertSame($this->post, $returned);
 }
开发者ID:sekouzed,项目名称:cabinet,代码行数:12,代码来源:DbPostRepositoryTest.php

示例4:

 function it_can_return_computed_column_type_info()
 {
     Cache::shouldReceive('has')->withAnyArgs()->once()->andReturn(false);
     Cache::shouldReceive('put')->withAnyArgs()->once();
     $type = \Mockery::mock('Doctrine\\DBAL\\Types\\Type');
     $type->shouldReceive('getName')->andReturn('Type');
     $column = \Mockery::mock('Doctrine\\DBAL\\Schema\\Column');
     $column->shouldReceive('getName')->andReturn('Column');
     $column->shouldReceive('getType')->andReturn($type);
     $table = \Mockery::mock('Doctrine\\DBAL\\Schema\\Table');
     $table->shouldReceive('getName')->andReturn('Table');
     $table->shouldReceive('getColumn')->withAnyArgs()->andReturn($column);
     $schemaManager = \Mockery::mock('Doctrine\\DBAL\\Schema\\AbstractSchemaManager');
     DB::shouldReceive('getDoctrineSchemaManager')->once()->andReturn($schemaManager);
     $schemaManager->shouldReceive('listTables')->once()->andReturn(['Table' => $table]);
     $this->getColumnType('Table', 'Column')->shouldBe('Type');
     \Mockery::close();
 }
开发者ID:hramose,项目名称:Auja-Laravel,代码行数:18,代码来源:MySQLDatabaseHelperSpec.php

示例5: testForgetCachedAssemblyItems

 public function testForgetCachedAssemblyItems()
 {
     $item = $this->newInventory();
     Cache::shouldReceive('forget')->once()->andReturn(true);
     $this->assertTrue($item->forgetCachedAssemblyItems());
 }
开发者ID:jonjonw,项目名称:inventory,代码行数:6,代码来源:InventoryAssemblyTest.php

示例6: testGetAllCollection

 public function testGetAllCollection()
 {
     $cache_id = 'cache-tag';
     $collection_model = Mockery::mock('C4tech\\Support\\Contracts\\ModelInterface');
     $collection = new Collection([$collection_model]);
     $response = 'awwyeah';
     $model = Mockery::mock('C4tech\\Support\\Contracts\\ModelInterface[all]');
     $model->shouldReceive('all')->withNoArgs()->once()->andReturn($collection);
     $this->repo->shouldReceive('getModelClass')->withNoArgs()->once()->andReturn($model);
     $this->repo->shouldReceive('getCacheId')->with('all', null)->once()->andReturn($cache_id);
     $this->repo->shouldReceive('makeCollection')->with($collection)->once()->andReturn($response);
     Cache::shouldReceive('tags->remember')->with([$model])->with($cache_id, Mockery::type('integer'), Mockery::on(function ($closure) use($response) {
         expect($closure())->equals($response);
         return true;
     }))->once()->andReturn(true);
     expect($this->repo->getAll())->equals(true);
 }
开发者ID:C4Tech,项目名称:laravel-support,代码行数:17,代码来源:RepositoryTest.php

示例7: testGetValues

 public function testGetValues()
 {
     Cache::shouldReceive('get')->once()->with('judge:values', [])->andReturn([]);
     $adapter = new CacheAdapter();
     self::assertEquals([], $adapter->getValues());
 }
开发者ID:jlis,项目名称:judge,代码行数:6,代码来源:CacheAdapterTest.php

示例8: testDetachRole

 public function testDetachRole()
 {
     /*
     |------------------------------------------------------------
     | Set
     |------------------------------------------------------------
     */
     $roleObject = m::mock('Role');
     $roleArray = ['id' => 2];
     $user = m::mock('HasRoleUser')->makePartial();
     /*
     |------------------------------------------------------------
     | Expectation
     |------------------------------------------------------------
     */
     $roleObject->shouldReceive('getKey')->andReturn(1);
     $user->shouldReceive('roles')->andReturn($user);
     $user->shouldReceive('detach')->with(1)->once()->ordered();
     $user->shouldReceive('detach')->with(2)->once()->ordered();
     $user->shouldReceive('detach')->with(3)->once()->ordered();
     Cache::shouldReceive('forget')->times(3);
     /*
     |------------------------------------------------------------
     | Assertion
     |------------------------------------------------------------
     */
     $user->detachRole($roleObject);
     $user->detachRole($roleArray);
     $user->detachRole(3);
 }
开发者ID:19peaches,项目名称:lumineer,代码行数:30,代码来源:LumineerUserTest.php

示例9: testGetUploads

 public function testGetUploads()
 {
     $tag = 'test-tag';
     $object = Mockery::mock('C4tech\\Upload\\Contracts\\UploadModelInterface');
     $new_object = 'Demo!';
     $collection = Mockery::mock('Illuminate\\Support\\Collection[map]', [[$object]]);
     $new_collection = 'TestCollection';
     $this->repo->shouldReceive('getTags')->with('uploads')->once()->andReturn([$tag]);
     $this->repo->shouldReceive('getCacheId')->with('uploads')->once()->andReturn($tag);
     $this->repo->shouldReceive('uploads->get')->withNoArgs()->once()->andReturn($collection);
     Upload::shouldReceive('make')->with($object)->once()->andReturn($new_object);
     $collection->shouldReceive('map')->with(Mockery::on(function ($closure) use($object, $new_object) {
         expect($closure($object))->equals($new_object);
         return true;
     }))->once()->andReturn($new_collection);
     Cache::shouldReceive('tags->remember')->with([$tag])->with($tag, Mockery::type('integer'), Mockery::on(function ($closure) use($new_collection) {
         expect($closure())->equals($new_collection);
         return true;
     }))->once()->andReturn(true);
     expect($this->repo->getUploads())->true();
 }
开发者ID:C4Tech,项目名称:laravel-upload,代码行数:21,代码来源:RepositoryTraitTest.php


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