/** * 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 Null(); $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('NullType', $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 Null(); $type->setGenerator($generator); $type->setLocale($locale); $type->setUtilities($utilities); $type->validate(); $values = array(); $this->assertEquals(null, $type->generate(1, $values)); $this->assertEquals(null, $type->generate(2, $values)); $this->assertEquals(null, $type->generate(3, $values)); }