/** * @test */ public function setsStrategy() { $strategy = $this->prophesize('Xi\\Filelib\\Asynchrony\\ExecutionStrategy\\ExecutionStrategy'); $strategy->attachTo($this->filelib)->shouldBeCalled(); $strategy->getIdentifier()->shouldBeCalled()->willReturn('xooxer'); $this->asynchrony->addStrategy($strategy->reveal()); $this->assertSame($this->filelib->getFileRepository(), $this->filelib->getFileRepository()->setExecutionStrategy(FileRepository::COMMAND_AFTERUPLOAD, 'xooxer')); $this->assertEquals('xooxer', $this->filelib->getFileRepository()->getExecutionStrategy(FileRepository::COMMAND_AFTERUPLOAD)); }
/** * @test */ public function canAddStrategy() { $filelib = new FileLibrary(new MemoryStorageAdapter(), new MemoryBackendAdapter()); $asynchrony = new Asynchrony($filelib); $strategy = $this->prophesize('Xi\\Filelib\\Asynchrony\\ExecutionStrategy\\ExecutionStrategy'); $strategy->getIdentifier()->willReturn('xooxoxx'); $strategy->attachTo($filelib)->shouldBeCalled(); $asynchrony->addStrategy($strategy->reveal()); }