mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-16 15:47:58 +00:00
get apt-get php-db package running on travis-ci (#973)
travis: /usr/bin/env php whenever calling PHP scripts to deal with phpenv
This commit is contained in:
@@ -151,7 +151,8 @@ class NominatimEnvironment(object):
|
||||
self.run_nominatim_script('update', *args, **kwargs)
|
||||
|
||||
def run_nominatim_script(self, script, *args, **kwargs):
|
||||
cmd = [os.path.join(self.build_dir, 'utils', '%s.php' % script)]
|
||||
cmd = ['/usr/bin/env', 'php', '-Cq']
|
||||
cmd.append(os.path.join(self.build_dir, 'utils', '%s.php' % script))
|
||||
cmd.extend(['--%s' % x for x in args])
|
||||
for k, v in kwargs.items():
|
||||
cmd.extend(('--' + k.replace('_', '-'), str(v)))
|
||||
|
||||
@@ -236,8 +236,9 @@ class DetailsResponse(GenericResponse):
|
||||
def query_cmd(context, query, dups):
|
||||
""" Query directly via PHP script.
|
||||
"""
|
||||
cmd = [os.path.join(context.nominatim.build_dir, 'utils', 'query.php'),
|
||||
'--search', query]
|
||||
cmd = ['/usr/bin/env', 'php']
|
||||
cmd.append(os.path.join(context.nominatim.build_dir, 'utils', 'query.php'))
|
||||
cmd.extend(['--search', query])
|
||||
# add more parameters in table form
|
||||
if context.table:
|
||||
for h in context.table.headings:
|
||||
@@ -282,7 +283,7 @@ def send_api_query(endpoint, params, fmt, context):
|
||||
if hasattr(context, 'http_headers'):
|
||||
env.update(context.http_headers)
|
||||
|
||||
cmd = ['/usr/bin/php-cgi', '-f']
|
||||
cmd = ['/usr/bin/env', 'php-cgi', '-f']
|
||||
if context.nominatim.code_coverage_path:
|
||||
env['COV_SCRIPT_FILENAME'] = env['SCRIPT_FILENAME']
|
||||
env['COV_PHP_DIR'] = os.path.join(context.nominatim.src_dir, "lib")
|
||||
@@ -307,7 +308,7 @@ def send_api_query(endpoint, params, fmt, context):
|
||||
+ outp + "\n===============================\n")
|
||||
|
||||
assert_equals(0, proc.returncode,
|
||||
"query.php failed with message: %s\noutput: %s" % (err, outp))
|
||||
"%s failed with message: %s\noutput: %s" % (env['SCRIPT_FILENAME'], err, outp))
|
||||
|
||||
assert_equals(0, len(err), "Unexpected PHP error: %s" % (err))
|
||||
|
||||
@@ -392,7 +393,6 @@ def website_lookup_request(context, fmt, query):
|
||||
|
||||
context.response = SearchResponse(outp, outfmt, status)
|
||||
|
||||
|
||||
@step(u'(?P<operator>less than|more than|exactly|at least|at most) (?P<number>\d+) results? (?:is|are) returned')
|
||||
def validate_result_number(context, operator, number):
|
||||
eq_(context.response.errorcode, 200)
|
||||
|
||||
Reference in New Issue
Block a user