#! /bin/sh
patch -p1 < debian/patches/DEP-8/Use-system-path.patch
patch -p1 < debian/patches/DEP-8/Skip-tests-failing-on-debci.patch
mkdir -p vendor
phpabtpl \
	--require phpunit/phpunit \
	--require-file ../tests/_files/deprecation-trigger/trigger_deprecation.php \
	--require-file ../tests/unit/Event/AbstractEventTestCase.php \
	--require-file ../tests/unit/TextUI/AbstractSourceFilterTestCase.php \
	--require-file ../tests/unit/Framework/MockObject/TestDoubleTestCase.php \
	--require-file ../tests/unit/Metadata/Parser/AttributeParserTestCase.php \
	--require-file ../tests/unit/Framework/Assert/assertContainsOnlyArrayTest.php \
	--require-file ../tests/unit/Framework/Assert/assertContainsOnlyBoolTest.php \
	--require-file ../tests/unit/Framework/Assert/assertContainsOnlyCallableTest.php \
	--require-file ../tests/unit/Framework/Assert/assertContainsOnlyFloatTest.php \
	--require-file ../tests/unit/Framework/Assert/assertContainsOnlyInstancesOfTest.php \
	--require-file ../tests/unit/Framework/Assert/assertContainsOnlyIntTest.php \
	--require-file ../tests/unit/Framework/Assert/assertContainsOnlyIterableTest.php \
	--require-file ../tests/unit/Framework/Assert/assertContainsOnlyNullTest.php \
	--require-file ../tests/unit/Framework/Assert/assertContainsOnlyNumericTest.php \
	--require-file ../tests/unit/Framework/Assert/assertContainsOnlyObjectTest.php \
	--require-file ../tests/unit/Framework/Assert/assertContainsOnlyResourceTest.php \
	--require-file ../tests/unit/Framework/Assert/assertContainsOnlyClosedResourceTest.php \
	--require-file ../tests/unit/Framework/Assert/assertContainsOnlyScalarTest.php \
	--require-file ../tests/unit/Framework/Assert/assertContainsOnlyStringTest.php \
	--require-file ../tests/unit/Framework/Assert/assertDirectoryExistsTest.php \
	--require-file ../tests/unit/Framework/Assert/assertFileExistsTest.php \
	--require-file ../tests/unit/Framework/Assert/assertIsNumericTest.php \
	--require-file ../tests/unit/Framework/Assert/assertIsObjectTest.php \
	--require-file ../tests/unit/Framework/Assert/assertIsReadableTest.php \
	--require-file ../tests/unit/Framework/Assert/assertIsResourceTest.php \
	--require-file ../tests/unit/Framework/Assert/assertIsScalarTest.php \
	--require-file ../tests/unit/Framework/Assert/assertIsStringTest.php \
	--require-file ../tests/unit/Framework/Assert/assertIsWritableTest.php \
	--require-file ../tests/unit/Framework/Assert/assertMatchesRegularExpressionTest.php \
	--require-file ../tests/unit/Framework/Assert/assertNullTest.php \
	--require-file ../tests/unit/Framework/Assert/assertSameSizeTest.php \
	--require-file ../tests/unit/Framework/Assert/assertSameTest.php \
	--require-file ../tests/unit/TextUI/Output/Default/ResultPrinterTest.php \
	--require-file ../tests/_files/CoveredFunction.php \
	--require-file ../tests/_files/Generator.php \
	--require-file ../tests/_files/NamespaceCoveredFunction.php \
	--require-file ../tests/end-to-end/_files/listing-tests-and-groups/ExampleAbstractTestCase.php \
	> debian/autoload.tests.php.tpl
phpab \
	--output vendor/autoload.php \
	--template debian/autoload.tests.php.tpl \
	tests/files
phpunit --display-skipped
exit=$?
patch -Rp1 < debian/patches/DEP-8/Skip-tests-failing-on-debci.patch
patch -Rp1 < debian/patches/DEP-8/Use-system-path.patch
exit $exit
