public function testSetLiteral() { $literal = new LiteralScope('scope1'); $literal->setLiteral('0001', 'a'); $literal->setLiteral('0002', 'b'); $literal->setLiteral('0003', 'c'); $literal->setLiteral('0004', 'd'); $result = $literal->getLiterals()->toArray(); $this->assertArrayHasKey('0001', $result); $this->assertArrayHasKey('0002', $result); $this->assertArrayHasKey('0003', $result); $this->assertArrayHasKey('0004', $result); }
public function testGenerateWithAlternatingStrategy() { $scope = new Scope('scope1'); $gen = new MersenneRandom(700); $result = ''; $scope->setMinOccurances(7); $scope->setMaxOccurances(7); for ($i = 1; $i <= 6; $i++) { $lit = new LiteralScope('label_' . $i); $lit->addLiteral($i); $scope->attach($lit); $lit = null; } $scope->useAlternatingStrategy(); $scope->generate($result, $gen); $this->assertRegExp('/[1-6]{7}/', $result); }