Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Commit

Permalink
feat: typed properties defaults to true
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-thebaud committed Apr 28, 2022
1 parent 9b52ce9 commit 4a94e9a
Show file tree
Hide file tree
Showing 17 changed files with 67 additions and 205 deletions.
2 changes: 1 addition & 1 deletion config/phpunitgen.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
| Tells if the test class properties should be typed or documented.
|--------------------------------------------------------------------------
*/
'testClassTypedProperties' => false,
'testClassTypedProperties' => true,

/*
|--------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ class BasicWithTypedPropertiesTestGeneratorTest extends AbstractGeneratorTester
{
public function testItGeneratesTests(): void
{
$this->assertGeneratedIs('BasicWithTypedProperties/Rendered', 'BasicWithTypedProperties/Source', [
$this->assertGeneratedIs('BasicWithoutTypedProperties/Rendered', 'BasicWithoutTypedProperties/Source', [
'implementations' => BasicTestGenerator::implementations(),
'testClassTypedProperties' => true,
'testClassTypedProperties' => false,
]);
}
}
15 changes: 3 additions & 12 deletions tests/Feature/Resources/Generators/Basic/Rendered.stub
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,11 @@ use Tests\TestCase;
*/
final class PersonTest extends TestCase
{
/**
* @var Person
*/
private $person;
private Person $person;

/**
* @var string
*/
private $name;
private string $name;

/**
* @var Work|Mock
*/
private $work;
private Work|Mock $work;

/**
* {@inheritdoc}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,20 @@ use Tests\TestCase;
*/
final class PersonTest extends TestCase
{
private Person $person;
/**
* @var Person
*/
private $person;

private string $name;
/**
* @var string
*/
private $name;

private Work|Mock $work;
/**
* @var Work|Mock
*/
private $work;

/**
* {@inheritdoc}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,9 @@ use Tests\TestCase;
*/
final class UserControllerTest extends TestCase
{
/**
* @var UserController
*/
private $userController;
private UserController $userController;

/**
* @var UserService|Mock
*/
private $userService;
private UserService|Mock $userService;

/**
* {@inheritdoc}
Expand Down
15 changes: 3 additions & 12 deletions tests/Feature/Resources/Generators/Laravel/Channel/Rendered.stub
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,11 @@ use Tests\TestCase;
*/
final class EventChannelTest extends TestCase
{
/**
* @var EventChannel
*/
private $eventChannel;
private EventChannel $eventChannel;

/**
* @var EventService|Mock
*/
private $eventService;
private EventService|Mock $eventService;

/**
* @var User
*/
private $user;
private User $user;

/**
* {@inheritdoc}
Expand Down
10 changes: 2 additions & 8 deletions tests/Feature/Resources/Generators/Laravel/Command/Rendered.stub
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,9 @@ use Tests\TestCase;
*/
final class PruneUsersCommandTest extends TestCase
{
/**
* @var PruneUsersCommand
*/
private $pruneUsersCommand;
private PruneUsersCommand $pruneUsersCommand;

/**
* @var UserService|Mock
*/
private $userService;
private UserService|Mock $userService;

/**
* {@inheritdoc}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,9 @@ use Tests\TestCase;
*/
final class UserControllerTest extends TestCase
{
/**
* @var UserController
*/
private $userController;
private UserController $userController;

/**
* @var UserService|Mock
*/
private $userService;
private UserService|Mock $userService;

/**
* {@inheritdoc}
Expand Down
10 changes: 2 additions & 8 deletions tests/Feature/Resources/Generators/Laravel/Job/Rendered.stub
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,9 @@ use Tests\TestCase;
*/
final class SendWelcomeMessageJobTest extends TestCase
{
/**
* @var SendWelcomeMessageJob
*/
private $sendWelcomeMessageJob;
private SendWelcomeMessageJob $sendWelcomeMessageJob;

/**
* @var User|Mock
*/
private $user;
private User|Mock $user;

/**
* {@inheritdoc}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,9 @@ use Tests\TestCase;
*/
final class NewUserListenerTest extends TestCase
{
/**
* @var NewUserListener
*/
private $newUserListener;
private NewUserListener $newUserListener;

/**
* @var UserService|Mock
*/
private $userService;
private UserService|Mock $userService;

/**
* {@inheritdoc}
Expand Down
15 changes: 3 additions & 12 deletions tests/Feature/Resources/Generators/Laravel/Policy/Rendered.stub
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,11 @@ use Tests\TestCase;
*/
final class ProductPolicyTest extends TestCase
{
/**
* @var ProductPolicy
*/
private $productPolicy;
private ProductPolicy $productPolicy;

/**
* @var RoleService|Mock
*/
private $roleService;
private RoleService|Mock $roleService;

/**
* @var User
*/
private $user;
private User $user;

/**
* {@inheritdoc}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,9 @@ use Tests\TestCase;
*/
final class ProductResourceTest extends TestCase
{
/**
* @var ProductResource
*/
private $productResource;
private ProductResource $productResource;

/**
* @var ProductService|Mock
*/
private $productService;
private ProductService|Mock $productService;

/**
* {@inheritdoc}
Expand Down
10 changes: 2 additions & 8 deletions tests/Feature/Resources/Generators/Laravel/Rule/Rendered.stub
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,9 @@ use Tests\TestCase;
*/
final class ProductRuleTest extends TestCase
{
/**
* @var ProductRule
*/
private $productRule;
private ProductRule $productRule;

/**
* @var ProductService|Mock
*/
private $productService;
private ProductService|Mock $productService;

/**
* {@inheritdoc}
Expand Down
25 changes: 5 additions & 20 deletions tests/Feature/Resources/Generators/Php8Features/Rendered.stub
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,15 @@ use Tests\TestCase;
*/
final class PersonTest extends TestCase
{
/**
* @var Person
*/
private $person;
private Person $person;

/**
* @var string
*/
private $name;
private string $name;

/**
* @var Work|Mock
*/
private $work;
private Work|Mock $work;

/**
* @var Post|Mock
*/
private $foo;
private Post|Mock $foo;

/**
* @var Post|Mock
*/
private $bar;
private Post|Mock $bar;

/**
* {@inheritdoc}
Expand Down
Loading

0 comments on commit 4a94e9a

Please sign in to comment.