summaryrefslogtreecommitdiffstats
path: root/tests/015-rpmmacro.phpt
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2024-12-19 09:08:31 +0100
committerRemi Collet <remi@php.net>2024-12-19 09:08:31 +0100
commit8997cc9cfca46c31d20a8e91372d63536f19ef0c (patch)
tree405dfdb8633845faa8ca151b77885fa15d2493af /tests/015-rpmmacro.phpt
parentdeb0dd428220509aa74242a230586065c3df53ff (diff)
add rpmexpand, rpmexpandnumeric to retrieve rpm macro value
add rpmdefine to set rpm macro value
Diffstat (limited to 'tests/015-rpmmacro.phpt')
-rw-r--r--tests/015-rpmmacro.phpt25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/015-rpmmacro.phpt b/tests/015-rpmmacro.phpt
new file mode 100644
index 0000000..13a92e1
--- /dev/null
+++ b/tests/015-rpmmacro.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Check for rpmdefine, rpmexpand, rpmexpandnumeric
+--SKIPIF--
+<?php if (!extension_loaded("rpminfo")) print "skip"; ?>
+--FILE--
+<?php
+var_dump(is_dir(rpmexpand("%{_dbpath}")));
+
+var_dump(rpmexpandnumeric("%__isa_bits") === PHP_INT_SIZE * 8);
+var_dump(rpmexpandnumeric("0%{?fedora}%{?rhel}") > 0);
+
+$name = "_my_test_macro_for_rpminfo_";
+$val = __FILE__;
+var_dump(rpmexpand("%$name") === "%$name" );
+var_dump(rpmdefine("$name $val"));
+var_dump(rpmexpand("%$name") === __FILE__);
+?>
+--EXPECT--
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+