summaryrefslogtreecommitdiffstats
path: root/php-williamdes-mariadb-mysql-kbs-layout.patch
blob: 9a7984e0af39bc828841a1d219cff3759204ade4 (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
40
diff -up ./src/Search.php.rpm ./src/Search.php
--- ./src/Search.php.rpm	2020-01-27 08:31:51.566856296 +0100
+++ ./src/Search.php	2020-01-27 08:32:31.160706000 +0100
@@ -31,7 +31,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	2020-01-26 21:00:05.000000000 +0100
+++ ./test/SearchTest.php	2020-01-27 08:31:51.566856296 +0100
@@ -175,4 +175,24 @@ 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);
+    }
 }