Slide 85
Slide 85 text
TEST
class BucketBallDistributionTest extends \PHPUnit_Framework_TestCase
{
/**
* @var BucketBallDistribution
*/
private $dist;
protected function build($minBucketsPerBall = 0, $minBallsPerBucket = 0)
{
$this->dist = new BucketBallDistribution($minBucketsPerBall, $minBallsPerBuck
}
public function testDistributeManyBucketToManyAppsLimit3()
{
$this->build(3, 1);
$bucketIds = array('a', 'b', 'c', 'd');
$ballIds = array('201', '202', '203', '204', '205', '206', '207', '208', '209
$results = $this->dist->run($bucketIds, $ballIds);
$expected = array(
'a' => array('201','205','209','203','207','204','208'),
'b' => array('202','206','210','204','208','201','205','209'),
'c' => array('203','207','201','205','209','202','206','210'),
'd' => array('204','208','202','206','210','203','207'),
);
$this->assertEquals($expected, $results);
}
}