SampleToOneRelationType::class, 'testToManyRelation' => SampleToManyRelationType::class, 'testToAnyRelation' => SampleToAnyRelationType::class, 'testToAnyMorphedRelation' => SampleToAnyMorphedRelationType::class, 'testToBadlyNamedNotManyRelation' => SampleToBadlyNamedNotManyRelationType::class, ]); Config::set('ide-helper.additional_relation_return_types', [ 'testToAnyRelation' => 'many', 'testToAnyMorphedRelation' => 'morphTo', 'testToBadlyNamedNotManyRelation' => 'one', ]); } public function test(): void { $command = $this->app->make(ModelsCommand::class); $tester = $this->runCommand($command, [ '--write' => true, ]); $this->assertSame(0, $tester->getStatusCode()); $this->assertStringContainsString('Written new phpDocBlock to', $tester->getDisplay()); $this->assertMatchesMockedSnapshot(); } public function testRelationNotNullable(): void { // Disable enforcing nullable relationships Config::set('ide-helper.enforce_nullable_relationships', false); $command = $this->app->make(ModelsCommand::class); $tester = $this->runCommand($command, [ '--write' => true, ]); $this->assertSame(0, $tester->getStatusCode()); $this->assertStringContainsString('Written new phpDocBlock to', $tester->getDisplay()); $this->assertMatchesMockedSnapshot(); // Re-enable default enforcing nullable relationships Config::set('ide-helper.enforce_nullable_relationships', true); } }