public function testDecideOnSuccessCleansOperationErrorDescription()
 {
     $strategy = new FakeStrategy();
     $strategy->fakeDecideOnFailure();
     $this->assertEquals($strategy::ERROR_DESCRIPTION, $strategy->getOperationErrorDescription());
     $strategy->fakeDecideOnSuccess();
     $this->assertNull($strategy->getOperationErrorDescription());
 }
Exemplo n.º 2
0
 public function testGetOperationErrorDescriptionReturnsErrorDescriptionOfStrategyThatDecidesOnError()
 {
     $queue = new StrategiesQueue();
     $target = new UploadTarget('foo');
     $first = new FakeStrategy();
     $second = new FakeStrategy();
     $third = new FakeStrategy();
     $second->fakeDecideOnOtherFailure();
     $queue->attach($first, 300)->attach($second, 200)->attach($third, 100);
     $queue(new UploadedFile(), $target);
     $this->assertSame($queue->getOperationErrorDescription(), $second::OTHER_ERROR_DESCRIPTION);
 }