Test Setup Failed
Push — master ( cd6248...207eab )
by Kevin
01:12
created
src/Helpers/PrimaryKeyRegistry.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
         $this->values = [];
52 52
         $colNames = implode(",", $this->columns);
53 53
         $rows = $this->connection->query("SELECT $colNames FROM " . $this->table->getName())->fetchAll();
54
-        foreach ($rows as $row){
54
+        foreach ($rows as $row) {
55 55
             $pk = [];
56
-            foreach ($this->columns as $column){
56
+            foreach ($this->columns as $column) {
57 57
                 $pk[$column] = $row[$column];
58 58
             }
59 59
             $this->values[] = $pk;
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
     {
72 72
         $keys = array_keys($value);
73 73
         sort($keys);
74
-        if ($this->columns == $keys){
74
+        if ($this->columns == $keys) {
75 75
             throw new PrimaryKeyColumnMismatchException("PrimaryKeys do not match between PKStore and addValue");
76 76
         }
77 77
         $this->values[] = $value;
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      */
83 83
     public function getRandomValue() : array
84 84
     {
85
-        return $this->values[random_int(0, count($this->values) -1)];
85
+        return $this->values[random_int(0, count($this->values) - 1)];
86 86
     }
87 87
 
88 88
     /**
Please login to merge, or discard this patch.
src/Generators/ComplexObjectGenerator.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@
 block discarded – undo
66 66
             if ($goDeeper){
67 67
                 $hasGoneDeeper = true;
68 68
                 $value = $this->generateRandomObject($depth - 1);
69
-            }else{
69
+            } else{
70 70
                 $value = $this->randomValue();
71 71
             }
72 72
             $obj->$propName = $value;
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -52,19 +52,19 @@
 block discarded – undo
52 52
         $obj = new \stdClass();
53 53
         $nbProps = random_int(2, 5);
54 54
         $hasGoneDeeper = false;
55
-        for ($i = 0; $i < $nbProps; $i++){
55
+        for ($i = 0; $i < $nbProps; $i++) {
56 56
             $propName = $this->randomPropName();
57
-            $goDeeper = $depth != 0 && (random_int(0,10) > 7 || !$hasGoneDeeper);
58
-            if ($goDeeper){
57
+            $goDeeper = $depth != 0 && (random_int(0, 10) > 7 || !$hasGoneDeeper);
58
+            if ($goDeeper) {
59 59
                 $hasGoneDeeper = true;
60 60
                 $value = $this->generateRandomObject($depth - 1);
61
-            }else{
61
+            }else {
62 62
                 $value = $this->randomValue();
63 63
             }
64 64
             $obj->$propName = $value;
65 65
         }
66 66
 
67
-        if ($this->toArray){
67
+        if ($this->toArray) {
68 68
             $obj = json_decode(json_encode($obj, JSON_OBJECT_AS_ARRAY), true);
69 69
         }
70 70
         return $obj;
Please login to merge, or discard this patch.
test.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,11 +19,11 @@  discard block
 block discarded – undo
19 19
 /* Don't hesitate to use the Faker package to generate random data,
20 20
    there is plenty of data types available (IBAN, address, country code, ...).
21 21
 */
22
-$dataFaker = \Faker\Factory::create();//you could pass the locale to generate localized data !
22
+$dataFaker = \Faker\Factory::create(); //you could pass the locale to generate localized data !
23 23
 
24 24
 // address.postal_code column is a varchar, so default generated data will be text. Here we want a postal code :
25 25
 $generatorFinderBuilder->addGenerator(
26
-    new \DBFaker\Generators\Conditions\CallBackCondition(function(\Doctrine\DBAL\Schema\Table $table,  \Doctrine\DBAL\Schema\Column $column){
26
+    new \DBFaker\Generators\Conditions\CallBackCondition(function(\Doctrine\DBAL\Schema\Table $table, \Doctrine\DBAL\Schema\Column $column) {
27 27
         return $table->getName() == "address" && $column->getName() == "postal_code";
28 28
     }),
29 29
     function() use ($dataFaker){
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 
34 34
 // all columns that end with "_email" or are named exactly "email" should be emails
35 35
 $generatorFinderBuilder->addGenerator(
36
-    new \DBFaker\Generators\Conditions\CallBackCondition(function(\Doctrine\DBAL\Schema\Table $table,  \Doctrine\DBAL\Schema\Column $column){
36
+    new \DBFaker\Generators\Conditions\CallBackCondition(function(\Doctrine\DBAL\Schema\Table $table, \Doctrine\DBAL\Schema\Column $column) {
37 37
         return preg_match("/([(.*_)|_|]|^)email$/", $column->getName()) === 1;
38 38
     }),
39 39
     function() use ($dataFaker){
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     "community_spending" => 100,
50 50
     "cron_flag" => 10,
51 51
     "project" => 50,
52
-    "project_note" => 200 ,
52
+    "project_note" => 200,
53 53
     "project_steps" => 10,
54 54
     "project_tasks" => 35,
55 55
     "request_hollidays" => 20,
Please login to merge, or discard this patch.
tests/DBFakerTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
             ->column("population")->bigInt()
61 61
             ->column("birthrate")->float()
62 62
             ->column("president_id")->references("persons")
63
-            ->column("population_density")->decimal(10,2)
63
+            ->column("population_density")->decimal(10, 2)
64 64
             ->column("summary")->text();
65 65
 
66 66
         $users->column("country_id")->references("countries");
@@ -103,11 +103,11 @@  discard block
 block discarded – undo
103 103
         /* Don't hesitate to use the Faker package to generate random data,
104 104
            there is plenty of data types available (IBAN, address, country code, ...).
105 105
         */
106
-        $dataFaker = \Faker\Factory::create();//you could pass the locale to generate localized data !
106
+        $dataFaker = \Faker\Factory::create(); //you could pass the locale to generate localized data !
107 107
 
108 108
         // address.postal_code column is a varchar, so default generated data will be text. Here we want a postal code :
109 109
         $generatorFinderBuilder->addGenerator(
110
-            new \DBFaker\Generators\Conditions\CallBackCondition(function(\Doctrine\DBAL\Schema\Table $table,  \Doctrine\DBAL\Schema\Column $column){
110
+            new \DBFaker\Generators\Conditions\CallBackCondition(function(\Doctrine\DBAL\Schema\Table $table, \Doctrine\DBAL\Schema\Column $column) {
111 111
                 return $table->getName() == "address" && $column->getName() == "postal_code";
112 112
             }),
113 113
             new SimpleGenerator(
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 
120 120
         // all columns that end with "_email" or are named exactly "email" should be emails
121 121
         $generatorFinderBuilder->addGenerator(
122
-            new CallBackCondition(function(\Doctrine\DBAL\Schema\Table $table,  \Doctrine\DBAL\Schema\Column $column){
122
+            new CallBackCondition(function(\Doctrine\DBAL\Schema\Table $table, \Doctrine\DBAL\Schema\Column $column) {
123 123
                 return preg_match("/([(.*_)|_|]|^)email$/", $column->getName()) === 1;
124 124
             }),
125 125
             new SimpleGenerator(
Please login to merge, or discard this patch.
tests/Generators/Conditions/CheckTypeConditionTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Helpers/NumericColumnLimitHelper.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -34,10 +34,10 @@  discard block
 block discarded – undo
34 34
      */
35 35
     public function __construct(Column $column)
36 36
     {
37
-        if (array_search($column->getType()->getName(), self::$handledNumberTypes) === false){
37
+        if (array_search($column->getType()->getName(), self::$handledNumberTypes) === false) {
38 38
             throw new UnsupportedDataTypeException("Unsupported column type : " .
39 39
                 $column->getType()->getName() . "only " .
40
-                implode("', '", self::$handledNumberTypes) ." types are supported."
40
+                implode("', '", self::$handledNumberTypes) . " types are supported."
41 41
             );
42 42
         }
43 43
         $this->column = $column;
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     public function getMinNumericValue()
51 51
     {
52 52
         $precisionValue = $this->getAbsValueByLengthPrecision($this->column);
53
-        switch ($this->column->getType()->getName()){
53
+        switch ($this->column->getType()->getName()) {
54 54
             case Type::BIGINT:
55 55
                 return $this->column->getUnsigned() ? 0 : bcpow(2, 63);
56 56
                 break;
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     public function getMaxNumericValue()
77 77
     {
78 78
         $precisionValue = $this->getAbsValueByLengthPrecision($this->column);
79
-        switch ($this->column->getType()->getName()){
79
+        switch ($this->column->getType()->getName()) {
80 80
             case Type::BIGINT:
81 81
                 return $this->column->getUnsigned() ? bcpow(2, 64) : bcpow(2, 63) - 1;
82 82
             case Type::INTEGER:
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
      */
97 97
     private function getAbsValueByLengthPrecision(Column $column)
98 98
     {
99
-        switch ($column->getType()->getName()){
99
+        switch ($column->getType()->getName()) {
100 100
             case Type::DECIMAL:
101 101
                 $str = str_repeat(9, $column->getScale());
102 102
                 return (double) substr_replace($str, ".", $column->getScale() - $column->getPrecision(), 0);
Please login to merge, or discard this patch.
src/Generators/BlobGenerator.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,11 +20,11 @@
 block discarded – undo
20 20
     public function __invoke(Column $column)
21 21
     {
22 22
         $files = glob($this->globExpression, GLOB_MARK);
23
-        $files = array_filter($files, function ($fileName){
23
+        $files = array_filter($files, function($fileName) {
24 24
             return strrpos($fileName, DIRECTORY_SEPARATOR) !== strlen($fileName) - 1;
25 25
         });
26
-        if (count($files) == 0){
27
-            throw new NoTestFilesFoundException("No files found for glob expression '".$this->globExpression."'");
26
+        if (count($files) == 0) {
27
+            throw new NoTestFilesFoundException("No files found for glob expression '" . $this->globExpression . "'");
28 28
         }
29 29
         $files = array_values($files);
30 30
         $chosenFile = $files[random_int(0, count($files) - 1)];
Please login to merge, or discard this patch.
src/Generators/Conditions/CheckTypeCondition.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
      */
22 22
     public function __construct(Type $type)
23 23
     {
24
-        if (!Type::hasType($type)){
24
+        if (!Type::hasType($type)) {
25 25
             throw new UnsupportedDataTypeException("Type '$$type' is not supported, please add it to DBAL types list (see Type::addType())");
26 26
         }
27 27
         $this->type = Type::getType($type);
Please login to merge, or discard this patch.
src/Generators/GeneratorFinder.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,14 +27,14 @@
 block discarded – undo
27 27
     public function findGenerator(Table $table, Column $column) : FakeDataGeneratorInterface
28 28
     {
29 29
         $generator = null;
30
-        if (!isset($this->generators[$table->getName() . "." . $column->getName()])){
31
-            foreach ($this->generatorFactories as list($condition, $generatorFactory)){
30
+        if (!isset($this->generators[$table->getName() . "." . $column->getName()])) {
31
+            foreach ($this->generatorFactories as list($condition, $generatorFactory)) {
32 32
                 /**  @var $condition ConditionInterface */
33
-                if ($condition->canApply($table, $column)){
33
+                if ($condition->canApply($table, $column)) {
34 34
                     $generator = $generatorFactory->create($table, $column);
35 35
                 }
36 36
             }
37
-            if (!$generator){
37
+            if (!$generator) {
38 38
                 throw new UnsupportedDataTypeException("Could not find suitable generator for column " . $table->getName() . "." . $column->getName() . " of type : " . $column->getType()->getName());
39 39
             }
40 40
             $this->generators[$table->getName() . "." . $column->getName()] = $generator;
Please login to merge, or discard this patch.