Skip to content

Commit ea354c2

Browse files
committed
fix: tests
refs: #50
1 parent 82e5640 commit ea354c2

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

src/Generators/AbstractTestsGenerator.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,11 +263,7 @@ protected function getRelatedModels($model): array
263263

264264
$publicMethods = (new ReflectionClass($class))->getMethods(ReflectionMethod::IS_PUBLIC);
265265

266-
$methods = array_filter($publicMethods, fn ($method) =>
267-
$method->class === $class
268-
&& !$method->getParameters()
269-
&& $method->getName() !== 'getRelationships'
270-
);
266+
$methods = array_filter($publicMethods, fn ($method) => $method->class === $class && !$method->getParameters());
271267

272268
$relatedModels = [];
273269

src/Generators/FactoryGenerator.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -267,11 +267,7 @@ protected function getRelatedModels($model): array
267267

268268
$publicMethods = (new ReflectionClass($class))->getMethods(ReflectionMethod::IS_PUBLIC);
269269

270-
$methods = array_filter($publicMethods, fn ($method) =>
271-
$method->class === $class
272-
&& !$method->getParameters()
273-
&& $method->getName() !== 'getRelationships'
274-
);
270+
$methods = array_filter($publicMethods, fn ($method) => $method->class === $class && !$method->getParameters());
275271

276272
$relatedModels = [];
277273

tests/NovaTestGeneratorTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use RonasIT\Support\Generators\NovaTestGenerator;
1111
use RonasIT\Support\Tests\Support\NovaTestGeneratorTest\NovaTestGeneratorMockTrait;
1212
use Laravel\Nova\NovaServiceProvider;
13+
use Mockery;
1314

1415
class NovaTestGeneratorTest extends TestCase
1516
{
@@ -56,6 +57,11 @@ className: ClassAlreadyExistsException::class,
5657

5758
public function testSuccess()
5859
{
60+
$mock = Mockery::mock('alias:Illuminate\Support\Facades\DB');
61+
$mock
62+
->shouldReceive('beginTransaction', 'rollBack')
63+
->once();
64+
5965
$this->mockClassExistsFunction(
6066
[
6167
'class' => NovaServiceProvider::class,

0 commit comments

Comments
 (0)