ScriptFUSIONTest\MockFactory::mockResource PHP Method

mockResource() public static method

public static mockResource ( ScriptFUSION\Porter\Provider\Provider $provider ) : Mockery\MockInterface | ScriptFUSION\Porter\Provider\Resource\ProviderResource
$provider ScriptFUSION\Porter\Provider\Provider
return Mockery\MockInterface | ScriptFUSION\Porter\Provider\Resource\ProviderResource
    public static function mockResource(Provider $provider)
    {
        return \Mockery::mock(ProviderResource::class)->shouldReceive('getProviderClassName')->andReturn(get_class($provider))->shouldReceive('getProviderTag')->andReturn(null)->byDefault()->getMock();
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * Tests that a clone of the provider's options are passed to ProviderResource::fetch().
  */
 public function testFetchWithOptions()
 {
     $this->setOptions($options = \Mockery::mock(EncapsulatedOptions::class));
     $this->provider->fetch(MockFactory::mockResource($this->provider)->shouldReceive('fetch')->with($this->connector, \Mockery::on(function (EncapsulatedOptions $argument) use($options) {
         self::assertNotSame($options, $argument);
         return get_class($options) === get_class($argument);
     }))->getMock());
 }
All Usage Examples Of ScriptFUSIONTest\MockFactory::mockResource