Skip to content

Commit 134756f

Browse files
authored
Add attributes for every test classes with annotations (#2893)
1 parent 2d65c00 commit 134756f

File tree

9 files changed

+27
-2
lines changed

9 files changed

+27
-2
lines changed

tests/Documents/FileWithoutMetadata.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class FileWithoutMetadata
1818
*
1919
* @var string|null
2020
*/
21+
#[ODM\File\Filename]
2122
private $filename;
2223

2324
public function getId(): ?string

tests/Tests/Mapping/AbstractMappingDriverTestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,15 +1254,15 @@ class AbstractMappingDriverDuplicateDatabaseNameNotSaved extends AbstractMapping
12541254
*
12551255
* @var string|null
12561256
*/
1257-
#[ODM\Field(type: 'int', name: 'baz')]
1257+
#[ODM\Field(type: 'string', name: 'baz')]
12581258
public $foo;
12591259

12601260
/**
12611261
* @ODM\Field(type="string", name="baz", notSaved=true)
12621262
*
12631263
* @var string|null
12641264
*/
1265-
#[ODM\Field(type: 'int', name: 'baz', notSaved: true)]
1265+
#[ODM\Field(type: 'string', name: 'baz', notSaved: true)]
12661266
public $bar;
12671267
}
12681268

tests/Tests/Mapping/Documents/GlobalNamespaceDocument.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,65 +6,75 @@
66
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
77

88
/** @ODM\Document */
9+
#[ODM\Document]
910
class DoctrineGlobal_Article
1011
{
1112
/**
1213
* @ODM\Id
1314
*
1415
* @var string|null
1516
*/
17+
#[ODM\Id]
1618
protected $id;
1719

1820
/**
1921
* @ODM\Field(type="string")
2022
*
2123
* @var string|null
2224
*/
25+
#[ODM\Field(type: 'string')]
2326
protected $headline;
2427

2528
/**
2629
* @ODM\Field(type="string")
2730
*
2831
* @var string|null
2932
*/
33+
#[ODM\Field(type: 'string')]
3034
protected $text;
3135

3236
/**
3337
* @ODM\ReferenceMany(targetDocument=DoctrineGlobal_User::class)
3438
*
3539
* @var DoctrineGlobal_User|null
3640
*/
41+
#[ODM\ReferenceMany(targetDocument: DoctrineGlobal_User::class)]
3742
protected $author;
3843

3944
/**
4045
* @ODM\ReferenceMany(targetDocument=DoctrineGlobal_User::class)
4146
*
4247
* @var Collection<int, DoctrineGlobal_User>
4348
*/
49+
#[ODM\ReferenceMany(targetDocument: DoctrineGlobal_User::class)]
4450
protected $editor;
4551
}
4652

4753
/** @ODM\Document */
54+
#[ODM\Document]
4855
class DoctrineGlobal_User
4956
{
5057
/**
5158
* @ODM\Id
5259
*
5360
* @var string|null
5461
*/
62+
#[ODM\Id]
5563
private $id;
5664

5765
/**
5866
* @ODM\Field(type="string")
5967
*
6068
* @var string
6169
*/
70+
#[ODM\Field(type: 'string')]
6271
private $username;
6372

6473
/**
6574
* @ODM\Field(type="string")
6675
*
6776
* @var string
6877
*/
78+
#[ODM\Field(type: 'string')]
6979
private $email;
7080
}

tests/Tests/Tools/GH1299/BaseUser.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,23 @@
77
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
88

99
/** @ODM\Document */
10+
#[ODM\Document]
1011
class BaseUser
1112
{
1213
/**
1314
* @ODM\Id
1415
*
1516
* @var string|null
1617
*/
18+
#[ODM\Id]
1719
protected $id;
1820

1921
/**
2022
* @ODM\Field(type="string")
2123
*
2224
* @var string|null
2325
*/
26+
#[ODM\Field(type: 'string')]
2427
protected $name;
2528

2629
public function getId(): ?string

tests/Tests/Tools/GH1299/GH1299User.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@
77
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
88

99
/** @ODM\Document */
10+
#[ODM\Document]
1011
class GH1299User extends BaseUser
1112
{
1213
/**
1314
* @ODM\Field(type="string")
1415
*
1516
* @var string|null
1617
*/
18+
#[ODM\Field(type: 'string')]
1719
protected $lastname;
1820
}

tests/Tests/Tools/GH297/Address.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@
77
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
88

99
/** @ODM\EmbeddedDocument */
10+
#[ODM\EmbeddedDocument]
1011
class Address
1112
{
1213
/**
1314
* @ODM\Field(type="string")
1415
*
1516
* @var string|null
1617
*/
18+
#[ODM\Field(type: 'string')]
1719
private $street;
1820

1921
public function getStreet(): ?string

tests/Tests/Tools/GH297/AddressTrait.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,16 @@
44

55
namespace Doctrine\ODM\MongoDB\Tests\Tools\GH297;
66

7+
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
8+
79
trait AddressTrait
810
{
911
/**
1012
* @ODM\EmbedOne
1113
*
1214
* @var Address|null
1315
*/
16+
#[ODM\EmbedOne]
1417
private $address;
1518

1619
public function getAddress(): ?Address

tests/Tests/Tools/GH297/Admin.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
88

99
/** @ODM\Document */
10+
#[ODM\Document]
1011
class Admin extends User
1112
{
1213
}

tests/Tests/Tools/GH297/User.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
88

99
/** @ODM\Document */
10+
#[ODM\Document]
1011
class User
1112
{
1213
use AddressTrait;
@@ -16,13 +17,15 @@ class User
1617
*
1718
* @var string|null
1819
*/
20+
#[ODM\Id]
1921
private $id;
2022

2123
/**
2224
* @ODM\Field(type="string")
2325
*
2426
* @var string|null
2527
*/
28+
#[ODM\Field(type: 'string')]
2629
private $name;
2730

2831
public function getId(): ?string

0 commit comments

Comments
 (0)