Skip to content

Commit 7826baa

Browse files
Generate HTTP Tests for defined controller actions (#64)
1 parent 212d7fc commit 7826baa

37 files changed

+758
-49
lines changed

src/BlueprintServiceProvider.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ function ($app) {
6666
$blueprint->registerGenerator(new \Blueprint\Generators\Statements\ViewGenerator($app['files']));
6767
$blueprint->registerGenerator(new \Blueprint\Generators\RouteGenerator($app['files']));
6868

69+
$blueprint->registerGenerator(new \Blueprint\Generators\TestGenerator($app['files']));
70+
6971
return $blueprint;
7072
});
7173

src/Builder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ public static function execute(Blueprint $blueprint, string $draft)
1616

1717
return $generated;
1818
}
19-
}
19+
}

src/Contracts/Lexer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
interface Lexer
66
{
77
public function analyze(array $tokens): array;
8-
}
8+
}

src/FileMixins.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
namespace Blueprint;
55

6-
76
class FileMixins
87
{
98
private $stubs = [];
@@ -18,4 +17,4 @@ public function stub()
1817
return $this->stubs[$path];
1918
};
2019
}
21-
}
20+
}

src/Generators/FactoryGenerator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ protected function buildDefinition(Model $model)
100100
);
101101
} else {
102102
$definition .= self::INDENT . "'{$column->name()}' => ";
103-
$faker = $this->fakerData($column->name()) ?? $this->fakerDataType($column->dataType());
103+
$faker = self::fakerData($column->name()) ?? self::fakerDataType($column->dataType());
104104
$definition .= '$faker->' . $faker;
105105
$definition .= ',' . PHP_EOL;
106106
}
@@ -109,7 +109,7 @@ protected function buildDefinition(Model $model)
109109
return trim($definition);
110110
}
111111

112-
protected function fakerData(string $name)
112+
public static function fakerData(string $name)
113113
{
114114
static $fakeableNames = [
115115
'address1' => 'streetAddress',
@@ -150,7 +150,7 @@ protected function fakerData(string $name)
150150
return $fakeableNames[$name] ?? null;
151151
}
152152

153-
protected function fakerDataType(string $type)
153+
public static function fakerDataType(string $type)
154154
{
155155
$fakeableTypes = [
156156
'id' => 'randomDigitNotNull',

src/Generators/Statements/EventGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,4 +114,4 @@ private function buildAssignments(array $data)
114114
return $output;
115115
}, ''));
116116
}
117-
}
117+
}

src/Generators/Statements/FormRequestGenerator.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,8 @@ private function validationRules(string $qualifier, string $column)
140140
return 'required';
141141
}
142142

143-
private function registerModels(?array $models)
143+
private function registerModels(array $models)
144144
{
145145
$this->models = $models;
146146
}
147-
148-
149-
}
147+
}

src/Generators/Statements/JobGenerator.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,5 +110,4 @@ private function buildAssignments(array $data)
110110
return $output;
111111
}, ''));
112112
}
113-
114-
}
113+
}

src/Generators/Statements/MailGenerator.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,5 +110,4 @@ private function buildAssignments(array $data)
110110
return $output;
111111
}, ''));
112112
}
113-
114-
}
113+
}

src/Generators/Statements/ViewGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,4 @@ protected function populateStub(string $stub, RenderStatement $renderStatement)
6363
{
6464
return str_replace('DummyView', $renderStatement->view(), $stub);
6565
}
66-
}
66+
}

0 commit comments

Comments
 (0)