#!/usr/bin/make -f

%:
	dh ${@}

override_dh_auto_build:
	phpabtpl \
		--basedir src \
		composer.json > \
		debian/autoload.php.tpl
	phpab \
		--output src/autoload.php \
		--template debian/autoload.php.tpl \
		src

execute_before_dh_auto_test:
	mkdir --parents vendor
	phpabtpl \
		--require-file ../src/autoload.php \
		--require-file /usr/share/php/GuzzleHttp/Server/Server.php \
		--require php-http/client-integration-tests \
		--require php-http/message-factory \
		--require psr/log \
		> debian/autoload.tests.php.tpl
	phpab \
		--output vendor/autoload.php \
		--template debian/autoload.tests.php.tpl \
		tests

override_dh_auto_test:
	php -S 127.0.0.1:10000 -t /usr/share/php/data/Http/Client/Tests/fixture &
	phpunit
	killall php
