summaryrefslogtreecommitdiffstats
path: root/php-williamdes-mariadb-mysql-kbs-layout.patch
blob: 9858a8ecc5a60dddc63b43a1ed825da5c0fa0563 (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
41
diff -up ./src/merge.php.rpm ./src/merge.php
diff -up ./src/Search.php.rpm ./src/Search.php
--- ./src/Search.php.rpm	2019-09-12 10:53:45.797567100 +0200
+++ ./src/Search.php	2019-09-12 11:01:04.702560202 +0200
@@ -25,7 +25,7 @@ class Search
     public const MYSQL      = 1;
     public const MARIADB    = 2;
     public const DS         = DIRECTORY_SEPARATOR;
-    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	2019-09-12 14:45:12.103423385 +0200
+++ ./test/SearchTest.php	2019-09-12 14:45:15.407409867 +0200
@@ -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->assertContains('php-williamdes-mariadb-mysql-kb', Search::$DATA_DIR);
+        $this->assertContains(getenv("RPM_BUILDROOT"), Search::$DATA_DIR);
+        $this->assertTrue(Search::$loaded);
+    }
 }