/** * @test * @dataProvider getBucketWithNumProvider */ public function getBucketWithNum($identifier, $expected_feature_1_bucket, $expected_feature_2_bucket) { $salt_1 = 'my_test_feature'; $salt_2 = 'banother_feature'; $num_buckets = 10; $identifier_hash_bucket = new IdentifierHashBucket($salt_1, $identifier, $num_buckets); $this->assertEquals($expected_feature_1_bucket, $identifier_hash_bucket->getBucket()); $this->assertEquals($expected_feature_1_bucket, $identifier_hash_bucket->getBucket()); $identifier_hash_bucket = new IdentifierHashBucket($salt_2, $identifier, $num_buckets); $this->assertEquals($expected_feature_2_bucket, $identifier_hash_bucket->getBucket()); $this->assertEquals($expected_feature_2_bucket, $identifier_hash_bucket->getBucket()); }
/** * @param string $identifier * * @return int */ protected function _getBucket($identifier) { $bucket = new IdentifierHashBucket($this->_feature, $identifier); return $bucket->getBucket(); }