/**
  * Instantiate and configure the node according to this definition
  *
  * @return Faker\Components\Engine\Common\Composite\TypeNode The node instance
  *
  * @throws InvalidDefinitionException When the definition is invalid
  */
 public function getNode()
 {
     $type = new ConstantString();
     $type->setGenerator($this->generator);
     $type->setUtilities($this->utilities);
     $type->setLocale($this->locale);
     foreach ($this->attributes as $attribute => $value) {
         $type->setOption($attribute, $value);
     }
     return new TypeNode('ConstantString', $this->eventDispatcher, $type);
 }
 public function testGenerate()
 {
     $utilities = $this->getMockBuilder('Faker\\Components\\Engine\\Common\\Utilities')->disableOriginalConstructor()->getMock();
     $generator = $this->getMock('\\PHPStats\\Generator\\GeneratorInterface');
     $locale = $this->getMock('\\Faker\\Locale\\LocaleInterface');
     $type = new ConstantString();
     $type->setLocale($locale);
     $type->setUtilities($utilities);
     $type->setGenerator($generator);
     $type->setOption('value', 'ccCC');
     $type->validate();
     $values = array();
     $this->assertEquals('ccCC', $type->generate(1, $values));
     $this->assertEquals('ccCC', $type->generate(2, $values));
     $this->assertEquals('ccCC', $type->generate(3, $values));
     $type = new ConstantNumber();
     $type->setGenerator($generator);
     $type->setLocale($locale);
     $type->setUtilities($utilities);
     $type->setOption('value', '123');
     $type->validate();
     $this->assertEquals(123, $type->generate(1, $values));
     $type = new ConstantString();
     $type->setGenerator($generator);
     $type->setLocale($locale);
     $type->setUtilities($utilities);
     $type->setOption('value', '1');
     $type->validate();
     $this->assertSame('1', $type->generate(1, $values));
 }