Skip to content

Commit 44e3166

Browse files
committed
Add more unit tests
1 parent c35dfc1 commit 44e3166

2 files changed

Lines changed: 616 additions & 64 deletions

File tree

‎src/ORM/MappingStrategy.php‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ public function build(): self
8181
}
8282
}
8383
if ($this->unknownAliases !== []) {
84-
throw new UnknownAliasException('Failed to map some aliases: ' . $this->unknownAliasesToString());
84+
$message = sprintf("None of the table associations match alias '%s'", $this->unknownAliasesToString());
85+
throw new UnknownAliasException($message);
8586
}
8687
return $this;
8788
}
@@ -131,10 +132,11 @@ private function scanRootLevel(Table $table): array
131132
$result[$type][$alias] = $firstLevelAssoc;
132133
}
133134
if ($unknownAliasesCount > 0 && $unknownAliasesCount === count($this->unknownAliases)) {
134-
throw new UnknownAliasException(
135-
'None of the root table associations match any remaining aliases: ' .
136-
$this->unknownAliasesToString()
135+
$message = sprintf(
136+
"None of the root table associations match alias '%s'",
137+
$this->unknownAliasesToString(),
137138
);
139+
throw new UnknownAliasException($message);
138140
}
139141
return $result;
140142
}
@@ -223,6 +225,6 @@ public function toArray(): array
223225

224226
private function unknownAliasesToString(): string
225227
{
226-
return implode(', ', array_keys($this->unknownAliases));
228+
return implode("', '", array_keys($this->unknownAliases));
227229
}
228230
}

0 commit comments

Comments
 (0)