/**
  * @covers \PhpCqrs\Domain\Identifier\Exception\NonStringIdentifier::forNonString
  */
 public function testCanConstructForNonString()
 {
     $exception = NonStringIdentifier::forNonString(1337);
     $this->assertInstanceOf(NonStringIdentifier::class, $exception);
     $this->assertSame('Non string identifier, got integer.', $exception->getMessage());
     $exception = NonStringIdentifier::forNonString(new stdClass());
     $this->assertSame('Non string identifier, got stdClass.', $exception->getMessage());
 }
 /**
  * @param string $identifier
  * @throws NonStringIdentifier
  */
 public function __construct($identifier)
 {
     if (!is_string($identifier)) {
         throw NonStringIdentifier::forNonString($identifier);
     }
     if (empty($identifier)) {
         throw NonStringIdentifier::forEmptyString();
     }
     $this->identifier = (string) $identifier;
 }