Skip to content

Conversation

@KonstantinLapkovsky
Copy link
Contributor

Issue #49

@KonstantinLapkovsky KonstantinLapkovsky changed the base branch from master to 49-cover-entity-generator-with-tests December 18, 2023 08:02
@KonstantinLapkovsky KonstantinLapkovsky changed the base branch from 49-cover-entity-generator-with-tests to master December 20, 2023 08:11
@KonstantinLapkovsky KonstantinLapkovsky changed the base branch from master to 49-cover-entity-generator-with-tests December 20, 2023 08:11
@DenTray
Copy link
Collaborator

DenTray commented Dec 26, 2023

@KonstantinLapkovsky please check all other mock traits according my comments

Konstantin Lapkovsky added 3 commits January 18, 2024 14:39
# Conflicts:
#	phpunit.xml
#	tests/Support/NovaTestMockTrait.php
@KonstantinLapkovsky KonstantinLapkovsky changed the base branch from 49-cover-entity-generator-with-tests to master January 18, 2024 13:02
@KonstantinLapkovsky KonstantinLapkovsky changed the base branch from master to 49-cover-entity-generator-with-tests January 18, 2024 13:02
@aizlee aizlee assigned DenTray and unassigned aizlee Oct 28, 2024
Comment on lines 41 to 43
$this->expectException(ClassNotExistsException::class);
$this->expectExceptionMessage('Cannot create Post Nova resource cause Post Model does not exists. '
. "Create a Post Model by himself or run command 'php artisan make:entity Post --only-model'");
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's wrap it to the helper

Suggested change
$this->expectException(ClassNotExistsException::class);
$this->expectExceptionMessage('Cannot create Post Nova resource cause Post Model does not exists. '
. "Create a Post Model by himself or run command 'php artisan make:entity Post --only-model'");
$this->assertExceptionThrowed(ClassNotExistsException::class, "Cannot create Post Nova resource cause Post Model does not exists. Create a Post Model by himself or run command 'php artisan make:entity Post --only-model'");

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 use already implemented assertExceptionThrowed helper instead?

@DenTray DenTray assigned aizlee and unassigned DenTray Oct 29, 2024
@aizlee aizlee assigned DenTray and unassigned aizlee Nov 15, 2024
Comment on lines 41 to 43
$this->expectException(ClassNotExistsException::class);
$this->expectExceptionMessage('Cannot create Post Nova resource cause Post Model does not exists. '
. "Create a Post Model by himself or run command 'php artisan make:entity Post --only-model'");
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 use already implemented assertExceptionThrowed helper instead?

use NovaTestMockTrait;
use NovaTestGeneratorMockTrait;

public function testCreateNovaTestsResourceNotExists()
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
public function testCreateNovaTestsResourceNotExists()
public function testGenerateResourceNotExists()

->generate();
}

public function testCreateNovaTestAlreadyExists()
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
public function testCreateNovaTestAlreadyExists()
public function testGenerateNovaTestAlreadyExists()

$this->assertGeneratedFileEquals('update_welcome_bonus_request.json', 'tests/fixtures/NovaWelcomeBonusTest/update_welcome_bonus_request.json');
}

public function testCreateWithMissingNovaPackage()
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
public function testCreateWithMissingNovaPackage()
public function testGenerateNovaPackageNotInstall()

Comment on lines 19 to 23

public function mockCheckingNovaPackageExistence(string $className, bool $result = false): void
{
$this->mockClassExistsFunction($className, $result);
}
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 anymore

Suggested change
public function mockCheckingNovaPackageExistence(string $className, bool $result = false): void
{
$this->mockClassExistsFunction($className, $result);
}

}

protected function getFieldsForCreation(): array
public function getFieldsForCreation(): array
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we change visibility for this function?

@DenTray DenTray removed their assignment Nov 18, 2024
use Doctrine\DBAL\Types\IntegerType;
use Doctrine\DBAL\Types\StringType;
use Illuminate\Support\Facades\Event;
use ReflectionClass;
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
use ReflectionClass;

- minor fixes
- removed unused methods
- use WelcomeBonusResource instead mocking NovaTestGenerator
@DenTray DenTray merged commit a22d3a2 into master Nov 18, 2024
2 checks passed
@DenTray DenTray deleted the 49-add-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.

4 participants