public function StockLevelTest::testSampeValueGenerator in Commerce Stock 8
Tests the ::generateSampleValue() method.
File
- modules/
field/ tests/ src/ Kernel/ StockLevelTest.php, line 230
Class
- StockLevelTest
- Ensure the stock level field works.
Namespace
Drupal\Tests\commerce_stock_field\KernelCode
public function testSampeValueGenerator() {
$i = 0;
$fieldDefinition = $this
->createMock(FieldDefinitionInterface::class);
while ($i < 100) {
$sampleValue = StockLevel::generateSampleValue($fieldDefinition);
$value = $sampleValue['value'];
$this
->assertTrue(is_float($value));
$this
->assertTrue(is_float($value));
$this
->assertTrue(999 >= $value && -999 <= $value);
$i++;
}
}