summaryrefslogtreecommitdiffstats
path: root/php-williamdes-mariadb-mysql-kbs-layout.patch
blob: 82b702230288213b19d42ed619163c2fb2cfdd7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
diff -up ./src/Search.php.rpm ./src/Search.php
--- ./src/Search.php.rpm	2021-12-20 10:47:08.194216239 +0100
+++ ./src/Search.php	2021-12-20 10:47:52.898097362 +0100
@@ -32,7 +32,7 @@ class Search
      *
      * @var string
      */
-    public static $DATA_DIR = __DIR__ . self::DS . '..' . self::DS . 'dist' . self::DS;
+    public static $DATA_DIR = '/usr/share/php-williamdes-mariadb-mysql-kbs/dist/';
 
     /**
      * Load data from disk
diff -up ./test/SearchTest.php.rpm ./test/SearchTest.php
--- ./test/SearchTest.php.rpm	2021-12-20 10:47:08.194216239 +0100
+++ ./test/SearchTest.php	2021-12-20 10:48:23.905014907 +0100
@@ -182,4 +182,23 @@ class SearchTest extends TestCase
         $this->assertEquals('boolean', $type);
     }
 
+    /**
+     * test RPM Layout
+     *
+     * @runInSeparateProcess
+     *
+     * @return void
+     */
+    public function testLayout(): void
+    {
+        if (!getenv("RPM_BUILDROOT")) {
+            $this->markTestSkipped("No RPM_BUILDROOT");
+        }
+        Search::$loaded = false;
+        Search::$DATA_DIR = getenv("RPM_BUILDROOT") . Search::$DATA_DIR;
+        $found = Search::getByName("max_connections", Search::MYSQL);
+        $this->assertStringContainsString('php-williamdes-mariadb-mysql-kb', Search::$DATA_DIR);
+        $this->assertStringContainsString(getenv("RPM_BUILDROOT"), Search::$DATA_DIR);
+        $this->assertTrue(Search::$loaded);
+    }
 }