Skip to content

Commit

Permalink
Remove $name from CmsUserTypes and adapt tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Lustmored committed Jan 26, 2021
1 parent ca85e0c commit ce31327
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 20 deletions.
6 changes: 0 additions & 6 deletions tests/Doctrine/Tests/Models/CMS/CmsUserTyped.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ class CmsUserTyped
*/
public string $username;

/**
* @Column(type="string", length=255)
* @var string
*/
public $name;

/**
* @Column
*/
Expand Down
20 changes: 6 additions & 14 deletions tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,6 @@ public function testFieldIsNullableByType(): void
$cm->mapField(['fieldName' => 'username', 'length' => 50]);
$this->assertFalse($cm->isNullable('username'));

// Implicit Not Nullable
$cm->mapField(['fieldName' => 'name', 'type' => 'string', 'length' => 50]);
$this->assertFalse($cm->isNullable('name'), 'By default a field should not be nullable.');

// Join table Nullable
$cm->mapOneToOne(['fieldName' => 'email', 'joinColumns' => [[]]]);
$this->assertFalse($cm->getAssociationMapping('email')['joinColumns'][0]['nullable']);
Expand All @@ -137,31 +133,27 @@ public function testFieldTypeFromReflection(): void
$cm->mapField(['fieldName' => 'username', 'length' => 50]);
$this->assertEquals('string', $cm->getTypeOfField('username'));

// Default string fallback
$cm->mapField(['fieldName' => 'name', 'type' => 'string', 'length' => 50]);
$this->assertEquals('string', $cm->getTypeOfField('name'), 'By default a field should be string.');

// String
// DateInterval object
$cm->mapField(['fieldName' => 'dateInterval']);
$this->assertEquals('dateinterval', $cm->getTypeOfField('dateInterval'));

// String
// DateTime object
$cm->mapField(['fieldName' => 'dateTime']);
$this->assertEquals('datetime', $cm->getTypeOfField('dateTime'));

// String
// DateTimeImmutable object
$cm->mapField(['fieldName' => 'dateTimeImmutable']);
$this->assertEquals('datetime_immutable', $cm->getTypeOfField('dateTimeImmutable'));

// String
// array as JSON
$cm->mapField(['fieldName' => 'array']);
$this->assertEquals('json', $cm->getTypeOfField('array'));

// String
// bool
$cm->mapField(['fieldName' => 'boolean']);
$this->assertEquals('boolean', $cm->getTypeOfField('boolean'));

// String
// float
$cm->mapField(['fieldName' => 'float']);
$this->assertEquals('float', $cm->getTypeOfField('float'));
}
Expand Down

0 comments on commit ce31327

Please sign in to comment.