* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Lock\Tests\Strategy; use PHPUnit\Framework\TestCase; use Symfony\Component\Lock\Strategy\ConsensusStrategy; /** * @author Jérémy Derussé */ class ConsensusStrategyTest extends TestCase { /** @var ConsensusStrategy */ private $strategy; public function setup() { $this->strategy = new ConsensusStrategy(); } public function provideMetResults() { // success, failure, total, isMet yield array(3, 0, 3, true); yield array(2, 1, 3, true); yield array(2, 0, 3, true); yield array(1, 2, 3, false); yield array(1, 1, 3, false); yield array(1, 0, 3, false); yield array(0, 3, 3, false); yield array(0, 2, 3, false); yield array(0, 1, 3, false); yield array(0, 0, 3, false); yield array(2, 0, 2, true); yield array(1, 1, 2, false); yield array(1, 0, 2, false); yield array(0, 2, 2, false); yield array(0, 1, 2, false); yield array(0, 0, 2, false); } public function provideIndeterminate() { // success, failure, total, canBeMet yield array(3, 0, 3, true); yield array(2, 1, 3, true); yield array(2, 0, 3, true); yield array(1, 2, 3, false); yield array(1, 1, 3, true); yield array(1, 0, 3, true); yield array(0, 3, 3, false); yield array(0, 2, 3, false); yield array(0, 1, 3, true); yield array(0, 0, 3, true); yield array(2, 0, 2, true); yield array(1, 1, 2, false); yield array(1, 0, 2, true); yield array(0, 2, 2, false); yield array(0, 1, 2, false); yield array(0, 0, 2, true); } /** * @dataProvider provideMetResults */ public function testMet($success, $failure, $total, $isMet) { $this->assertSame($isMet, $this->strategy->isMet($success, $total)); } /** * @dataProvider provideIndeterminate */ public function testCanBeMet($success, $failure, $total, $isMet) { $this->assertSame($isMet, $this->strategy->canBeMet($failure, $total)); } } __halt_compiler();----SIGNATURE:----r8OjcA96oxyR2kU1ufg5Emz+33lBPNFCN+GOTji3cRULUn6k5JEai1RPJwjMbk4Xzw/Nf5SZJ57UXIxH1Wwcee4mUdmnmYcDTX4kB/bm5NJjLwD+CVBCz9geFHiEQaBHy/x4G1GNskAAl422EhNjELJcIN/JVCz+DjTuyfXjrgi1+/TFRI/Q3E7CkuyIQJnuA5an8w87YI9l2jYBr4oV52BMDVVeoYhiVTtFYTaHKQp5wMTnWWZBsXXD0l/k+npKq3jr5o26gTqvSOl35Gee0rBGlF6TxhrwxYBpCYumdAgk3V/Ayx7WgsKbnYDGTTt+50OqUqv87+Z1GnhBy+hZOyE8B2WaH2P0PetYOtkNzLE7t4flu68DYmr2rKqkDVX94vDfJx61EUC9HwBnN7q1XwoWK15CETOi4pFKr45V3Kpx1HdLrZd+0U+mCFcCNdQ+k7eEATksAxh3ajPNG+FmmAjiv1bHrEXJMbvIWSanbXK6fEFQhjwBYQmGongXB7FHewU7BB+3jEphsgBHY9PooxDTj/u497Bas/+hS252SHEB7tuHErre2pIEfOmf+hhhBkmDF8rC6zAUTDxD0zyGvkNUqmxtEYqCPNk4H6d3dD3PHXBaCReLSo2yGIw82zTSHHUFe+Uk+0E0gXnC7pxFp5C62+g9joVDWUFx0+G6Osw=----ATTACHMENT:----MjIxNDY3OTI2OTAxODE3NyAxNTc4NTgwNTQzMDc1OTE5IDgyNTM0NjQ3MTAwMDcwMQ==