public function testValidBehaviour() { $field = $this->factory->createArray('name'); $values = $field->getValues(); static::assertTrue(is_array($values)); static::assertCount(1, $values); }
public function testValidBehaviour() { $field = $this->factory->createString('name'); $values = $field->setMinLength(5)->setMaxLength(20)->getValues(); static::assertTrue(is_array($values)); static::assertCount(2, $values); static::assertSame(5, strlen($values[0])); static::assertSame(20, strlen($values[1])); }
public function testValidBehaviour() { $field = $this->factory->createNumeric('name'); $values = $field->setMin(5)->setMax(20)->getValues(); static::assertTrue(is_array($values)); static::assertCount(2, $values); static::assertSame(5, $values[0]); static::assertSame(20, $values[1]); }
public function test() { $fieldFactory = new FieldFactory(); $faker = new InvalidDataFaker(); $data = $faker->addField($fieldFactory->createString('name')->setMinLength(3)->setMaxLength(20))->addField($fieldFactory->createNumeric('age')->setMin(18)->setMax(343))->getData(); static::assertTrue(is_array($data)); static::assertCount(3, $data); static::assertArrayHasKey('name', $data[0]); static::assertArrayHasKey('age', $data[0]); }
public function test() { $fieldFactory = new FieldFactory(); $faker = new DataFaker(); $data = $faker->addField($fieldFactory->createString('name1')->setMinLength(3)->setMaxLength(20))->addField($fieldFactory->createString('name2')->setMinLength(3))->addField($fieldFactory->createString('name3')->setMaxLength(3))->addField($fieldFactory->createNumeric('age1')->setMin(18)->setMax(343))->addField($fieldFactory->createNumeric('age2')->setMin(18))->addField($fieldFactory->createNumeric('age3')->setMax(18))->getData(); static::assertTrue(is_array($data)); foreach ($data as $item) { static::assertCount(6, $item); static::assertArrayHasKey('name1', $item); static::assertArrayHasKey('name2', $item); static::assertArrayHasKey('name3', $item); static::assertArrayHasKey('age1', $item); static::assertArrayHasKey('age2', $item); static::assertArrayHasKey('age3', $item); } }
public function testNameFailure() { $this->setExpectedExceptionRegExp(\InvalidArgumentException::class, '/Please, provide a field name/'); $this->factory->createArray(null); }
public function testMaxFailure() { $field = $this->factory->createNumeric('name'); $this->setExpectedExceptionRegExp(\InvalidArgumentException::class, '/A max value must be greater than/'); $field->setMin(2)->setMax(1); }
public function testNumeric() { static::assertTrue($this->factory->createNumeric('name') instanceof NumericField); }