@@ -8,7 +8,7 @@ |
||
| 8 | 8 | |
| 9 | 9 | class CheckTypeConditionTest extends TestCase |
| 10 | 10 | { |
| 11 | - public function testCanApply(){ |
|
| 11 | + public function testCanApply() { |
|
| 12 | 12 | $table = new Table("foo"); |
| 13 | 13 | $column = new Column("bar", Type::getType(Type::DECIMAL)); |
| 14 | 14 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | ->column("population")->bigInt() |
| 64 | 64 | ->column("birthrate")->float() |
| 65 | 65 | ->column("president_id")->references("persons") |
| 66 | - ->column("population_density")->decimal(10,2) |
|
| 66 | + ->column("population_density")->decimal(10, 2) |
|
| 67 | 67 | ->column("summary")->text(); |
| 68 | 68 | |
| 69 | 69 | $users->column("country_id")->references("countries"); |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | // address.postal_code column is a varchar, so default generated data will be text. Here we want a postal code : |
| 112 | 112 | $generatorFinderBuilder->addGenerator( |
| 113 | - new \DBFaker\Generators\Conditions\CallBackCondition(function(\Doctrine\DBAL\Schema\Table $table, \Doctrine\DBAL\Schema\Column $column){ |
|
| 113 | + new \DBFaker\Generators\Conditions\CallBackCondition(function(\Doctrine\DBAL\Schema\Table $table, \Doctrine\DBAL\Schema\Column $column) { |
|
| 114 | 114 | return $table->getName() == "address" && $column->getName() == "postal_code"; |
| 115 | 115 | }), |
| 116 | 116 | new SimpleGeneratorFactory("postcode") |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | // all columns that end with "_email" or are named exactly "email" should be emails |
| 120 | 120 | $generatorFinderBuilder->addGenerator( |
| 121 | - new CallBackCondition(function(\Doctrine\DBAL\Schema\Table $table, \Doctrine\DBAL\Schema\Column $column){ |
|
| 121 | + new CallBackCondition(function(\Doctrine\DBAL\Schema\Table $table, \Doctrine\DBAL\Schema\Column $column) { |
|
| 122 | 122 | return preg_match("/([(.*_)|_|]|^)email$/", $column->getName()) === 1; |
| 123 | 123 | }), |
| 124 | 124 | new SimpleGeneratorFactory("email") |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | $faker->setFakeTableRowNumbers($tableRowNumbers); |
| 147 | 147 | $faker->fakeDB(); |
| 148 | 148 | |
| 149 | - foreach ($tableRowNumbers as $tableName => $expectedCount){ |
|
| 149 | + foreach ($tableRowNumbers as $tableName => $expectedCount) { |
|
| 150 | 150 | $count = $conn->fetchColumn('SELECT count(*) from ' . $tableName); |
| 151 | 151 | $this->assertEquals($expectedCount, $count); |
| 152 | 152 | } |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | public function __construct(string $globExpression) |
| 20 | 20 | { |
| 21 | - $this->globExpression= $globExpression; |
|
| 21 | + $this->globExpression = $globExpression; |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /** |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | { |
| 16 | 16 | $column = new Column('foo', Type::getType(Type::BINARY)); |
| 17 | 17 | $column->setLength(255); |
| 18 | - $blobGenerator = new BlobGenerator(__DIR__.'/../fixtures/blob/*.png', $column); |
|
| 18 | + $blobGenerator = new BlobGenerator(__DIR__ . '/../fixtures/blob/*.png', $column); |
|
| 19 | 19 | $this->expectException(FileTooLargeException::class); |
| 20 | 20 | $blobGenerator->__invoke(); |
| 21 | 21 | } |
@@ -64,7 +64,7 @@ |
||
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | if (!$lookupColumn) { |
| 67 | - throw new SchemaLogicException("Could not find foreign column for local column '".$table->getName().".".$column->getName()."'"); |
|
| 67 | + throw new SchemaLogicException("Could not find foreign column for local column '" . $table->getName() . "." . $column->getName() . "'"); |
|
| 68 | 68 | } |
| 69 | 69 | return $lookupColumn; |
| 70 | 70 | } |
@@ -110,7 +110,7 @@ |
||
| 110 | 110 | */ |
| 111 | 111 | public function getRandomValue(array $excludedValues) : array |
| 112 | 112 | { |
| 113 | - $values = array_filter($this->values, function ($value) use ($excludedValues) { |
|
| 113 | + $values = array_filter($this->values, function($value) use ($excludedValues) { |
|
| 114 | 114 | return !\in_array($value, $excludedValues, true); |
| 115 | 115 | }); |
| 116 | 116 | return $values[array_rand($values, 1)]; |
@@ -52,10 +52,10 @@ |
||
| 52 | 52 | $foreignTable = $schemaManager->listTableDetails($foreignTableName); |
| 53 | 53 | $pkRegistry = $dbFaker->getPkRegistry($foreignTable); |
| 54 | 54 | $values = $pkRegistry->loadValuesFromTable()->getAllValues(); |
| 55 | - $this->possibleValues[$columnName] = array_map(function ($value) use ($foreignColumn) { |
|
| 55 | + $this->possibleValues[$columnName] = array_map(function($value) use ($foreignColumn) { |
|
| 56 | 56 | return $value[$foreignColumn->getName()]; |
| 57 | 57 | }, $values); |
| 58 | - } else { |
|
| 58 | + }else { |
|
| 59 | 59 | $generator = $dbFaker->getSimpleColumnGenerator($table, $column); |
| 60 | 60 | for ($i = 0; $i < $valuesCount; $i++) { |
| 61 | 61 | $this->possibleValues[$columnName][] = $generator(); |
@@ -79,7 +79,7 @@ |
||
| 79 | 79 | return true; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - $filtered = array_filter($this->generatedValues, function ($value) use ($object) { |
|
| 82 | + $filtered = array_filter($this->generatedValues, function($value) use ($object) { |
|
| 83 | 83 | return $object === $value; |
| 84 | 84 | }); |
| 85 | 85 | return count($filtered) === 0; |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | case Type::FLOAT: |
| 62 | 62 | return $this->faker->randomFloat(10, $this->min, $this->max); |
| 63 | 63 | default: |
| 64 | - throw new UnsupportedDataTypeException("Cannot generate numeric value for Type : '".$column->getType()->getName()."'"); |
|
| 64 | + throw new UnsupportedDataTypeException("Cannot generate numeric value for Type : '" . $column->getType()->getName() . "'"); |
|
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | |