/** * Testing toString methods and assert no mutation */ public function testToString() { $repositoryName = 'foo/bar'; $repositoryNameObject = RepositoryName::fromString($repositoryName); $this->assertEquals($repositoryName, (string) $repositoryNameObject); $this->assertEquals($repositoryName, $repositoryNameObject->toString()); }
public static function fromArray(array $array) { Ensure::keyExists($array, 'title'); Ensure::keyExists($array, 'repositoryName'); Ensure::keyExists($array, 'url'); Ensure::keyExists($array, 'loneliness'); return self::create(Title::fromString($array['title']), RepositoryName::fromString($array['repositoryName']), Url::fromString($array['url']), Loneliness::fromInteger($array['loneliness'])); }
/** * @param $array * * @return Notification */ public static function fromArray($array) { Ensure::keyExists($array, 'repositoryName'); Ensure::keyExists($array, 'title'); Ensure::keyExists($array, 'url'); Ensure::keyExists($array, 'eventDateTime'); return new self(RepositoryName::fromString($array['repositoryName']), Title::fromString($array['title']), Url::fromString($array['url']), new DateTimeImmutable($array['eventDateTime'])); }
public function testConvertToDatabaseValue() { $repositoryNameName = 'foo/bar'; $repositoryName = RepositoryName::fromString($repositoryNameName); $databaseValue = $this->type->convertToDatabaseValue($repositoryName, $this->platform); $this->assertTrue(gettype($databaseValue) === 'string'); $this->assertSame($databaseValue, $repositoryNameName); $databaseValue = $this->type->convertToDatabaseValue($repositoryName, $this->platform); $this->assertTrue(gettype($databaseValue) === 'string'); $this->assertSame($databaseValue, $repositoryNameName); }
/** * {{@inheritdoc}} */ public function getByRepositoryName(RepositoryName $repositoryName) { return $this->findOneBy(['repositoryName' => $repositoryName->toString()]); }
/** * {@inheritdoc} */ public function convertToPHPValue($value, AbstractPlatform $platform) { return RepositoryName::fromString($value); }