Skip to content

Conversation

@KonstantinLapkovsky
Copy link
Contributor

Issue #49

@KonstantinLapkovsky KonstantinLapkovsky self-assigned this Dec 20, 2023
@KonstantinLapkovsky KonstantinLapkovsky changed the base branch from master to 49-cover-entity-generator-with-tests December 20, 2023 19:15
@AZabolotnikov AZabolotnikov self-assigned this Nov 20, 2024
# Conflicts:
#	tests/ControllerGeneratorTest.php
#	tests/NovaResourceGeneratorTest.php
#	tests/NovaTestGeneratorTest.php
#	tests/Support/Controller/ControllerMockTrait.php
#	tests/Support/NovaResource/NovaResourceMockTrait.php
#	tests/Support/NovaTest/NovaTestMockTrait.php
#	tests/Support/Shared/GeneratorMockTrait.php
#	tests/TestCase.php
…erator-tests

# Conflicts:
#	tests/Support/Factory/FactoryMockTrait.php
Copy link
Collaborator

@DenTray DenTray left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please change target branch and merge it with the current master

@pirs1337 pirs1337 assigned pirs1337 and unassigned AZabolotnikov Dec 9, 2024
@pirs1337 pirs1337 changed the base branch from 49-cover-entity-generator-with-tests to master December 19, 2024 11:20
@pirs1337 pirs1337 assigned DenTray and unassigned pirs1337 Dec 19, 2024
foreach ($relationsByType as $relation) {
if (!$this->classExists('models', $relation)) {
$this->throwFailureException(
ClassNotExistsException::class,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add arg names for multiline style

]);
}

public function mockGeneratorForMissingRelationModel(): void
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems this method is not using

{
return $this->hasMany(User::class);
}
protected $casts = [
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we change casts place after the hidden property

{
public function some_relation()
{

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

@DenTray DenTray assigned pirs1337 and unassigned DenTray Dec 23, 2024
@pirs1337 pirs1337 assigned DenTray and unassigned pirs1337 Jan 10, 2025
@@ -0,0 +1,10 @@
<?php
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


class ModelGeneratorTest extends TestCase
{
use ModelMockTrait, MockTrait;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we just use MockTrait into Generator MockTrait?

@DenTray DenTray assigned pirs1337 and unassigned DenTray Jan 13, 2025
@pirs1337 pirs1337 assigned DenTray and unassigned pirs1337 Jan 14, 2025
}

if ($this->isStubExists('model') && ($this->isStubExists('relation') || empty($this->relations))) {
if ($this->isStubExists('model') && (collect($this->relations)->every(fn ($relation) => empty($relation)) || $this->isStubExists('relation', 'model'))) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if ($this->isStubExists('model') && (collect($this->relations)->every(fn ($relation) => empty($relation)) || $this->isStubExists('relation', 'model'))) {
if ($this->isStubExists('model') && (!$this->hasRelations() || $this->isStubExists('relation', 'model'))) {

@DenTray DenTray assigned pirs1337 and unassigned DenTray Jan 14, 2025
@pirs1337 pirs1337 assigned DenTray and unassigned pirs1337 Jan 15, 2025
@DenTray DenTray merged commit 3b523a6 into master Jan 15, 2025
1 check passed
@DenTray DenTray deleted the 49-add-model-generator-tests branch July 8, 2025 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants