THRIFT-4423: migrate to psr-4
Client: php

This closes #1445
diff --git a/lib/php/test/Makefile.am b/lib/php/test/Makefile.am
index c872b1a..c4dcde3 100755
--- a/lib/php/test/Makefile.am
+++ b/lib/php/test/Makefile.am
@@ -17,6 +17,8 @@
 # under the License.
 #
 
+PHPUNIT=php $(top_srcdir)/vendor/bin/phpunit
+
 stubs: ../../../test/ThriftTest.thrift  TestValidators.thrift
 	mkdir -p ./packages
 	$(THRIFT) --gen php -r --out ./packages ../../../test/ThriftTest.thrift
@@ -27,23 +29,24 @@
 	$(THRIFT) --gen php:validate,oop -r --out ./packages/phpvo  TestValidators.thrift
 	$(THRIFT) --gen php:json         -r --out ./packages/phpjs  TestValidators.thrift
 
-check-json-serializer: stubs
-if HAVE_PHPUNIT
-	$(PHPUNIT) --log-junit=TEST-json-serializer.xml Test/Thrift/JsonSerialize/
-endif
+deps: $(top_srcdir)/composer.json
+	composer install --working-dir=$(top_srcdir)
 
-check-validator: stubs
+all-local: deps
+
+check-json-serializer: deps stubs
+	$(PHPUNIT) --log-junit=TEST-json-serializer.xml Test/Thrift/JsonSerialize/
+
+check-validator: deps stubs
 	php Test/Thrift/TestValidators.php
 	php Test/Thrift/TestValidators.php -oop
 
-check-protocol:	stubs
-if HAVE_PHPUNIT
+check-protocol:	deps stubs
 	$(PHPUNIT) --log-junit=TEST-log-json-protocol.xml Test/Thrift/Protocol/TestTJSONProtocol.php
 	$(PHPUNIT) --log-junit=TEST-binary-serializer.xml Test/Thrift/Protocol/TestBinarySerializer.php
 	$(PHPUNIT) --log-junit=TEST-log-simple-json-protocol.xml Test/Thrift/Protocol/TestTSimpleJSONProtocol.php
-endif
 
-check: stubs \
+check: deps stubs \
   check-protocol \
   check-validator \
   check-json-serializer
@@ -55,5 +58,3 @@
 EXTRA_DIST = \
 	Test \
 	TestValidators.thrift
-
-