Repository: DamienHarper/auditor (php)

Issue:
Invalid audit table name with schema
<!--
- Please do not report an issue for a version of `auditor` that is no longer supported. Currently supported versions are listed here: https://github.com/DamienHarper/auditor#version-information
- Please fill in this template according to your issue.
- Please keep the table shown below at the top of your issue.
- You can retrieve `auditor` version by running `composer info | grep "auditor"`.
- You can retrieve PHP version by running `php -v`.
- Please post code as text (using proper markup). Do not post screenshots of code.
- Please remove this comment before submitting your issue.
-->

| Q                    | A
| ---------------------| -----------------------
| `auditor` version    | 2.4.7
| PHP version          | 8.2
| Database             | PostgreSQL

#### Summary

Invalid computed audit table name if I use Doctrine schema

#### Current behavior

prefixschema.%table%suffix

#### How to reproduce

create entity with schema 

#### Expected behavior

schema.prefix%table%suffix



Pull request description:
Invalid schema
Closes #174 

Don't forget please to make a new release

Patch:
diff --git a/src/Provider/Doctrine/Persistence/Schema/SchemaManager.php b/src/Provider/Doctrine/Persistence/Schema/SchemaManager.php
index d034c60..ac6b4a3 100644
--- a/src/Provider/Doctrine/Persistence/Schema/SchemaManager.php
+++ b/src/Provider/Doctrine/Persistence/Schema/SchemaManager.php
@@ -270,7 +270,7 @@ final class SchemaManager
     public function computeAuditTablename(string $entityTableName, Configuration $configuration): ?string
     {
         return preg_replace(
-            sprintf('#^([^\.]+\.)?(%s)$#', preg_quote($entityTableName, '#')),
+            '#^([^.]+\.)?(.+)$#',
             sprintf(
                 '$1%s$2%s',
                 preg_quote($configuration->getTablePrefix(), '#'),


Test patch:
diff --git a/tests/Provider/Doctrine/Issues/Issue174Test.php b/tests/Provider/Doctrine/Issues/Issue174Test.php
new file mode 100644
index 0000000..aee4f39
--- /dev/null
+++ b/tests/Provider/Doctrine/Issues/Issue174Test.php
@@ -0,0 +1,30 @@
+<?php
+
+declare(strict_types=1);
+
+namespace DH\Auditor\Tests\Provider\Doctrine\Issues;
+
+use DH\Auditor\Provider\Doctrine\Configuration;
+use DH\Auditor\Provider\Doctrine\Persistence\Schema\SchemaManager;
+use DH\Auditor\Tests\Provider\Doctrine\Traits\Schema\DefaultSchemaSetupTrait;
+use PHPUnit\Framework\TestCase;
+
+/**
+ * @internal
+ */
+#[\PHPUnit\Framework\Attributes\Small]
+/**
+ * @internal
+ */
+final class Issue174Test extends TestCase
+{
+    use DefaultSchemaSetupTrait;
+
+    public function testIssue174(): void
+    {
+        $configuration = new Configuration(['table_prefix' => 'audit_', 'table_suffix' => '_suffix']);
+        $manager = new SchemaManager($this->provider);
+        $result = $manager->computeAuditTablename('schema.entity', $configuration);
+        self::assertSame('schema.audit_entity_suffix', $result);
+    }
+}