public static mockResource ( ScriptFUSION\Porter\Provider\Provider $provider ) : Mockery\MockInterface | ScriptFUSION\Porter\Provider\Resource\ProviderResource | ||
$provider | ScriptFUSION\Porter\Provider\Provider | |
Résultat | Mockery\MockInterface | ScriptFUSION\Porter\Provider\Resource\ProviderResource |
/** * 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()); }
public function testApplyCacheAdvice() { $this->porter->registerProvider($provider = \Mockery::mock(implode(',', [Provider::class, CacheToggle::class]))->shouldReceive('fetch')->andReturn(new \EmptyIterator())->shouldReceive('disableCache')->once()->shouldReceive('enableCache')->once()->getMock()); $this->porter->import($specification = new ImportSpecification(MockFactory::mockResource($provider))); $this->porter->import($specification->setCacheAdvice(CacheAdvice::SHOULD_CACHE())); }