THRIFT-5756 Run php tests in github actions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index aeb1614..aca1a37 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -76,6 +76,62 @@
           path: compiler/cpp/thrift
           retention-days: 3
 
+  lib-php:
+    needs: compiler
+    runs-on: ubuntu-20.04
+    strategy:
+      matrix:
+        php-version: [5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3]
+      fail-fast: false
+    steps:
+      - uses: actions/checkout@v4
+
+      - name: Set up PHP
+        uses: shivammathur/setup-php@v2
+        with:
+          php-version: ${{ matrix.php-version }}
+          extensions: mbstring, intl, xml
+
+      - name: Install Dependencies
+        run: composer install
+
+      - name: Backward compatibility for unit test in php greater then 7.1
+        if: matrix.php-version > 7.0
+        run: |
+          sed -i 's/setUp()/setUp():void/' lib/php/test/Unit/*Test.php
+          sed -i 's/setUpBeforeClass()/setUpBeforeClass():void/' lib/php/test/Unit/*Test.php
+
+      - name: Run bootstrap
+        run: ./bootstrap.sh
+
+      - name: Run configure
+        run: |
+          ./configure $(echo $CONFIG_ARGS_FOR_LIBS | sed 's/without-php/with-php/' | sed 's/without-php_extension/with-php_extension/' )
+
+      - uses: actions/download-artifact@v3
+        with:
+          name: thrift-compiler
+          path: compiler/cpp
+
+      - name: Run thrift-compiler
+        run: |
+          chmod a+x compiler/cpp/thrift
+          compiler/cpp/thrift -version
+
+      - name: Build Thrift Classes
+        run: |
+          mkdir -p ./lib/php/test/Resources/packages/php
+          mkdir -p ./lib/php/test/Resources/packages/phpv
+          mkdir -p ./lib/php/test/Resources/packages/phpvo
+          mkdir -p ./lib/php/test/Resources/packages/phpjs
+          compiler/cpp/thrift --gen php              -r --out ./lib/php/test/Resources/packages/php    lib/php/test/Resources/ThriftTest.thrift
+          compiler/cpp/thrift --gen php:validate     -r --out ./lib/php/test/Resources/packages/phpv   lib/php/test/Resources/ThriftTest.thrift
+          compiler/cpp/thrift --gen php:validate,oop -r --out ./lib/php/test/Resources/packages/phpvo  lib/php/test/Resources/ThriftTest.thrift
+          compiler/cpp/thrift --gen php:json         -r --out ./lib/php/test/Resources/packages/phpjs  lib/php/test/Resources/ThriftTest.thrift
+
+      - name: Run Tests
+        run: vendor/bin/phpunit -c lib/php/phpunit.xml
+
   lib-go:
     needs: compiler
     runs-on: ubuntu-20.04
diff --git a/.gitignore b/.gitignore
index cb8029c..0ed4729 100644
--- a/.gitignore
+++ b/.gitignore
@@ -279,9 +279,8 @@
 /lib/php/src/ext/thrift_protocol/run-tests.php
 /lib/php/src/ext/thrift_protocol/thrift_protocol.la
 /lib/php/src/ext/thrift_protocol/tmp-php.ini
-/lib/php/src/packages/
-/lib/php/test/TEST-*.xml
-/lib/php/test/packages/
+/lib/php/tests/Resources/packages/
+/lib/php/test/test-log-junit.xml
 /lib/py/dist/
 /lib/erl/logs/
 /lib/go/pkg
diff --git a/build/docker/ubuntu-bionic/Dockerfile b/build/docker/ubuntu-bionic/Dockerfile
index 350921a..5ece6e1 100644
--- a/build/docker/ubuntu-bionic/Dockerfile
+++ b/build/docker/ubuntu-bionic/Dockerfile
@@ -216,9 +216,14 @@
       php-dev \
       php-json \
       php-pear \
+      php-mbstring \
+      php-xml \
       re2c \
       composer
 
+RUN pecl install xdebug-3.1.1 && \
+      echo "zend_extension=xdebug.so" > /etc/php/7.2/cli/conf.d/20-xdebug.ini
+
 RUN apt-get install -y --no-install-recommends \
       `# Python dependencies` \
       python-all \
diff --git a/composer.json b/composer.json
index 454beea..d882a97 100644
--- a/composer.json
+++ b/composer.json
@@ -21,8 +21,10 @@
         "php": "^5.5 || ^7.0 || ^8.0"
     },
     "require-dev": {
-        "phpunit/phpunit": "~4.8.36",
-        "squizlabs/php_codesniffer": "3.*"
+        "phpunit/phpunit": "^4.8 || ^5.7 || ^6.5 || ^7.5 || ^8.5 || ^9.3",
+        "squizlabs/php_codesniffer": "3.*",
+        "ext-json": "*",
+        "ext-xml": "*"
     },
     "autoload": {
         "psr-4": {"Thrift\\": "lib/php/lib/"}
diff --git a/lib/php/README.apache.md b/lib/php/README.apache.md
index 5e92589..2fae257 100644
--- a/lib/php/README.apache.md
+++ b/lib/php/README.apache.md
@@ -29,7 +29,7 @@
 
 Sample Code
 ===========
-
+```php
 <?php
 
 namespace MyNamespace;
@@ -72,3 +72,4 @@
 $transport->open();
 $processor->process($protocol, $protocol);
 $transport->close();
+```
diff --git a/lib/php/phpunit.xml b/lib/php/phpunit.xml
new file mode 100644
index 0000000..a5d287f
--- /dev/null
+++ b/lib/php/phpunit.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         bootstrap="../../vendor/autoload.php"
+         cacheResult="false"
+         colors="true"
+         convertErrorsToExceptions="true"
+         convertNoticesToExceptions="true"
+         convertWarningsToExceptions="true"
+         stopOnWarning="true"
+         stopOnFailure="true"
+         processIsolation="true"
+         xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
+    <coverage includeUncoveredFiles="true">
+        <include>
+            <directory suffix=".php">./src</directory>
+            <directory suffix=".php">./lib</directory>
+        </include>
+    </coverage>
+    <testsuites>
+        <testsuite name="Thrift PHP Test Suite">
+            <directory>./test/Unit</directory>
+        </testsuite>
+    </testsuites>
+</phpunit>
diff --git a/lib/php/test/Fixtures.php b/lib/php/test/Fixtures/Fixtures.php
similarity index 99%
rename from lib/php/test/Fixtures.php
rename to lib/php/test/Fixtures/Fixtures.php
index fd57d83..eb348fc 100644
--- a/lib/php/test/Fixtures.php
+++ b/lib/php/test/Fixtures/Fixtures.php
@@ -21,7 +21,7 @@
  * @package thrift.test
  */
 
-namespace Test\Thrift;
+namespace Test\Thrift\Fixtures;
 
 use ThriftTest\Xtruct;
 use ThriftTest\Xtruct2;
diff --git a/lib/php/test/Protocol/TJSONProtocolFixtures.php b/lib/php/test/Fixtures/TJSONProtocolFixtures.php
similarity index 99%
rename from lib/php/test/Protocol/TJSONProtocolFixtures.php
rename to lib/php/test/Fixtures/TJSONProtocolFixtures.php
index dd9039f..81ada77 100644
--- a/lib/php/test/Protocol/TJSONProtocolFixtures.php
+++ b/lib/php/test/Fixtures/TJSONProtocolFixtures.php
@@ -21,7 +21,7 @@
  * @package thrift.test
  */
 
-namespace Test\Thrift\Protocol;
+namespace Test\Thrift\Fixtures;
 
 class TJSONProtocolFixtures
 {
diff --git a/lib/php/test/Protocol/TSimpleJSONProtocolFixtures.php b/lib/php/test/Fixtures/TSimpleJSONProtocolFixtures.php
similarity index 99%
rename from lib/php/test/Protocol/TSimpleJSONProtocolFixtures.php
rename to lib/php/test/Fixtures/TSimpleJSONProtocolFixtures.php
index 547fd86..448eb61 100644
--- a/lib/php/test/Protocol/TSimpleJSONProtocolFixtures.php
+++ b/lib/php/test/Fixtures/TSimpleJSONProtocolFixtures.php
@@ -21,7 +21,7 @@
  * @package thrift.test
  */
 
-namespace test\Thrift\Protocol;
+namespace Test\Thrift\Fixtures;
 
 class TSimpleJSONProtocolFixtures
 {
diff --git a/lib/php/test/Makefile.am b/lib/php/test/Makefile.am
index 30765c3..c2de405 100644
--- a/lib/php/test/Makefile.am
+++ b/lib/php/test/Makefile.am
@@ -19,37 +19,26 @@
 
 PHPUNIT=php $(top_srcdir)/vendor/bin/phpunit
 
-stubs: ../../../test/v0.16/ThriftTest.thrift  TestValidators.thrift
-	mkdir -p ./packages/php
-	$(THRIFT) --gen php -r --out ./packages/php ../../../test/v0.16/ThriftTest.thrift
-	mkdir -p ./packages/phpv
-	mkdir -p ./packages/phpvo
-	mkdir -p ./packages/phpjs
-	$(THRIFT) --gen php:validate     -r --out ./packages/phpv   TestValidators.thrift
-	$(THRIFT) --gen php:validate,oop -r --out ./packages/phpvo  TestValidators.thrift
-	$(THRIFT) --gen php:json         -r --out ./packages/phpjs  TestValidators.thrift
+stubs: Resources/ThriftTest.thrift
+	mkdir -p ./Resources/packages/php
+	mkdir -p ./Resources/packages/phpv
+	mkdir -p ./Resources/packages/phpvo
+	mkdir -p ./Resources/packages/phpjs
+	$(THRIFT) --gen php              -r --out ./Resources/packages/php    Resources/ThriftTest.thrift
+	$(THRIFT) --gen php:validate     -r --out ./Resources/packages/phpv   Resources/ThriftTest.thrift
+	$(THRIFT) --gen php:validate,oop -r --out ./Resources/packages/phpvo  Resources/ThriftTest.thrift
+	$(THRIFT) --gen php:json         -r --out ./Resources/packages/phpjs  Resources/ThriftTest.thrift
 
 deps: $(top_srcdir)/composer.json
 	composer install --working-dir=$(top_srcdir)
 
 all-local: deps
 
-check-json-serializer: deps stubs
-	$(PHPUNIT) --log-junit=TEST-log-json-serializer.xml JsonSerialize/
-
-check-validator: deps stubs
-	$(PHPUNIT) --log-junit=TEST-log-validator.xml Validator/
-
-check-protocol:	deps stubs
-	$(PHPUNIT) --log-junit=TEST-log-protocol.xml Protocol/
-
-check: deps stubs \
-  check-protocol \
-  check-validator \
-  check-json-serializer
+check: deps stubs
+	$(PHPUNIT) --log-junit=test-log-junit.xml -c phpunit.xml /
 
 distclean-local:
 
 clean-local:
-	$(RM) -r ./packages
-	$(RM) TEST-*.xml
+	$(RM) -r ./Resources/packages
+	$(RM) test-log-junit.xml
diff --git a/lib/php/test/TestValidators.thrift b/lib/php/test/Resources/ThriftTest.thrift
similarity index 94%
rename from lib/php/test/TestValidators.thrift
rename to lib/php/test/Resources/ThriftTest.thrift
index a980470..07ca6e4 100644
--- a/lib/php/test/TestValidators.thrift
+++ b/lib/php/test/Resources/ThriftTest.thrift
@@ -19,7 +19,7 @@
 
 namespace php TestValidators
 
-include "../../../test/v0.16/ThriftTest.thrift"
+include "../../../../test/v0.16/ThriftTest.thrift"
 
 union UnionOfStrings {
   1: string aa;
diff --git a/lib/php/test/Validator/BaseValidatorTest.php b/lib/php/test/Unit/BaseValidatorTest.php
similarity index 90%
rename from lib/php/test/Validator/BaseValidatorTest.php
rename to lib/php/test/Unit/BaseValidatorTest.php
index 6029083..4404e72 100644
--- a/lib/php/test/Validator/BaseValidatorTest.php
+++ b/lib/php/test/Unit/BaseValidatorTest.php
@@ -1,4 +1,5 @@
 <?php
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements. See the NOTICE file
@@ -18,7 +19,7 @@
  * under the License.
  */
 
-namespace Test\Thrift;
+namespace Test\Thrift\Unit;
 
 use PHPUnit\Framework\TestCase;
 use Thrift\Exception\TProtocolException;
@@ -62,6 +63,7 @@
         $transport = new TMemoryBuffer("\000");
         $protocol = new TBinaryProtocol($transport);
         $bonk->read($protocol);
+        $this->assertTrue(true);
     }
 
     public function testWriteEmpty()
@@ -73,6 +75,8 @@
             $bonk->write($protocol);
             $this->fail('Bonk was able to write an empty object');
         } catch (TProtocolException $e) {
+            $this->expectExceptionMessage('Required field Bonk.message is unset!');
+            throw $e;
         }
     }
 
@@ -87,6 +91,8 @@
             $structa->write($protocol);
             $this->fail('StructA was able to write an empty object');
         } catch (TProtocolException $e) {
+            $this->expectExceptionMessage('Required field StructA.s is unset!');
+            throw $e;
         }
     }
 
@@ -114,6 +120,8 @@
     {
         if (!static::hasReadValidator($class)) {
             static::fail($class . ' class should have a read validator');
+        } else {
+            static::assertTrue(true);
         }
     }
 
@@ -121,6 +129,8 @@
     {
         if (static::hasReadValidator($class)) {
             static::fail($class . ' class should not have a write validator');
+        } else {
+            static::assertTrue(true);
         }
     }
 
@@ -128,6 +138,8 @@
     {
         if (!static::hasWriteValidator($class)) {
             static::fail($class . ' class should have a write validator');
+        } else {
+            static::assertTrue(true);
         }
     }
 
@@ -135,6 +147,8 @@
     {
         if (static::hasWriteValidator($class)) {
             static::fail($class . ' class should not have a write validator');
+        } else {
+            static::assertTrue(true);
         }
     }
 
diff --git a/lib/php/test/Protocol/BinarySerializerTest.php b/lib/php/test/Unit/BinarySerializerTest.php
similarity index 72%
rename from lib/php/test/Protocol/BinarySerializerTest.php
rename to lib/php/test/Unit/BinarySerializerTest.php
index 71b0bb5..b97da74 100644
--- a/lib/php/test/Protocol/BinarySerializerTest.php
+++ b/lib/php/test/Unit/BinarySerializerTest.php
@@ -17,33 +17,26 @@
  * KIND, either express or implied. See the License for the
  * specific language governing permissions and limitations
  * under the License.
- *
- * @package thrift.test
  */
 
-namespace Test\Thrift\Protocol;
+namespace Test\Thrift\Unit;
 
 use PHPUnit\Framework\TestCase;
+use Thrift\ClassLoader\ThriftClassLoader;
 use Thrift\Serializer\TBinarySerializer;
 
-require __DIR__ . '/../../../../vendor/autoload.php';
-
 /***
- * This test suite depends on running the compiler against the
- * standard ThriftTest.thrift file:
- *
- * lib/php/test$ ../../../compiler/cpp/thrift --gen php -r \
- *   --out ./packages ../../../test/ThriftTest.thrift
- *
- * @runTestsInSeparateProcesses
+ * This test suite depends on running the compiler against the ./Resources/ThriftTest.thrift file:
+ * lib/php/test$ ../../../compiler/cpp/thrift --gen php -r  --out ./Resources/packages/php ./Resources/ThriftTest.thrift
  */
 class BinarySerializerTest extends TestCase
 {
     public function setUp()
     {
-        /** @var \Composer\Autoload\ClassLoader $loader */
-        $loader = require __DIR__ . '/../../../../vendor/autoload.php';
-        $loader->addPsr4('', __DIR__ . '/../packages/php');
+        $loader = new ThriftClassLoader();
+        $loader->registerNamespace('ThriftTest', __DIR__ . '/../Resources/packages/php');
+        $loader->registerDefinition('ThriftTest', __DIR__ . '/../Resources/packages/php');
+        $loader->register();
     }
 
     /**
diff --git a/lib/php/test/JsonSerialize/JsonSerializeTest.php b/lib/php/test/Unit/JsonSerializeTest.php
similarity index 86%
rename from lib/php/test/JsonSerialize/JsonSerializeTest.php
rename to lib/php/test/Unit/JsonSerializeTest.php
index c668652..9fdc3f3 100644
--- a/lib/php/test/JsonSerialize/JsonSerializeTest.php
+++ b/lib/php/test/Unit/JsonSerializeTest.php
@@ -1,4 +1,5 @@
 <?php
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements. See the NOTICE file
@@ -18,26 +19,24 @@
  * under the License.
  */
 
-namespace Test\Thrift\JsonSerialize;
+namespace Test\Thrift\Unit;
 
 use PHPUnit\Framework\TestCase;
 use stdClass;
+use Thrift\ClassLoader\ThriftClassLoader;
 
-require __DIR__ . '/../../../../vendor/autoload.php';
-
-/**
- * @runTestsInSeparateProcesses
+/***
+ * This test suite depends on running the compiler against the ./Resources/ThriftTest.thrift file:
+ * lib/php/test$ ../../../compiler/cpp/thrift --gen php:json -r  --out ./Resources/packages/phpjs ./Resources/ThriftTest.thrift
  */
 class JsonSerializeTest extends TestCase
 {
     protected function setUp()
     {
-        if (version_compare(phpversion(), '5.4', '<')) {
-            $this->markTestSkipped('Requires PHP 5.4 or newer!');
-        }
-        /** @var \Composer\Autoload\ClassLoader $loader */
-        $loader = require __DIR__ . '/../../../../vendor/autoload.php';
-        $loader->addPsr4('', __DIR__ . '/../packages/phpjs');
+        $loader = new ThriftClassLoader();
+        $loader->registerNamespace('ThriftTest', __DIR__ . '/../Resources/packages/phpjs');
+        $loader->registerDefinition('ThriftTest', __DIR__ . '/../Resources/packages/phpjs');
+        $loader->register();
     }
 
     public function testEmptyStruct()
diff --git a/lib/php/test/Protocol/TJSONProtocolTest.php b/lib/php/test/Unit/TJSONProtocolTest.php
similarity index 95%
rename from lib/php/test/Protocol/TJSONProtocolTest.php
rename to lib/php/test/Unit/TJSONProtocolTest.php
index bf0ecce..178d63b 100644
--- a/lib/php/test/Protocol/TJSONProtocolTest.php
+++ b/lib/php/test/Unit/TJSONProtocolTest.php
@@ -17,27 +17,20 @@
  * KIND, either express or implied. See the License for the
  * specific language governing permissions and limitations
  * under the License.
- *
- * @package thrift.test
  */
 
-namespace Test\Thrift\Protocol;
+namespace Test\Thrift\Unit;
 
 use PHPUnit\Framework\TestCase;
-use Test\Thrift\Fixtures;
+use Test\Thrift\Fixtures\Fixtures;
+use Test\Thrift\Fixtures\TJSONProtocolFixtures;
+use Thrift\ClassLoader\ThriftClassLoader;
 use Thrift\Protocol\TJSONProtocol;
 use Thrift\Transport\TMemoryBuffer;
 
-require __DIR__ . '/../../../../vendor/autoload.php';
-
 /***
- * This test suite depends on running the compiler against the
- * standard ThriftTest.thrift file:
- *
- * lib/php/test$ ../../../compiler/cpp/thrift --gen php -r \
- *   --out ./packages ../../../test/ThriftTest.thrift
- *
- * @runTestsInSeparateProcesses
+ * This test suite depends on running the compiler against the ./Resources/ThriftTest.thrift file:
+ * lib/php/test$ ../../../compiler/cpp/thrift --gen php -r  --out ./Resources/packages/php ./Resources/ThriftTest.thrift
  */
 class TJSONProtocolTest extends TestCase
 {
@@ -46,9 +39,10 @@
 
     public static function setUpBeforeClass()
     {
-        /** @var \Composer\Autoload\ClassLoader $loader */
-        $loader = require __DIR__ . '/../../../../vendor/autoload.php';
-        $loader->addPsr4('', __DIR__ . '/../packages/php');
+        $loader = new ThriftClassLoader();
+        $loader->registerNamespace('ThriftTest', __DIR__ . '/../Resources/packages/php');
+        $loader->registerDefinition('ThriftTest', __DIR__ . '/../Resources/packages/php');
+        $loader->register();
 
         Fixtures::populateTestArgs();
         TJSONProtocolFixtures::populateTestArgsJSON();
@@ -265,7 +259,9 @@
             TJSONProtocolFixtures::$testArgsJSON['testVoid']
         );
         $args = new \ThriftTest\ThriftTest_testVoid_args();
-        $args->read($this->protocol);
+        $result = $args->read($this->protocol);
+
+        $this->assertEquals(0, $result);
     }
 
     public function testString1Read()
diff --git a/lib/php/test/Protocol/TSimpleJSONProtocolTest.php b/lib/php/test/Unit/TSimpleJSONProtocolTest.php
similarity index 91%
rename from lib/php/test/Protocol/TSimpleJSONProtocolTest.php
rename to lib/php/test/Unit/TSimpleJSONProtocolTest.php
index e4a1373..3189d99 100644
--- a/lib/php/test/Protocol/TSimpleJSONProtocolTest.php
+++ b/lib/php/test/Unit/TSimpleJSONProtocolTest.php
@@ -17,27 +17,20 @@
  * KIND, either express or implied. See the License for the
  * specific language governing permissions and limitations
  * under the License.
- *
- * @package thrift.test
  */
 
-namespace Test\Thrift\Protocol;
+namespace Test\Thrift\Unit;
 
 use PHPUnit\Framework\TestCase;
-use Test\Thrift\Fixtures;
+use Test\Thrift\Fixtures\Fixtures;
+use Test\Thrift\Fixtures\TSimpleJSONProtocolFixtures;
+use Thrift\ClassLoader\ThriftClassLoader;
 use Thrift\Protocol\TSimpleJSONProtocol;
 use Thrift\Transport\TMemoryBuffer;
 
-require __DIR__ . '/../../../../vendor/autoload.php';
-
 /***
- * This test suite depends on running the compiler against the
- * standard ThriftTest.thrift file:
- *
- * lib/php/test$ ../../../compiler/cpp/thrift --gen php -r \
- *   --out ./packages ../../../test/ThriftTest.thrift
- *
- * @runTestsInSeparateProcesses
+ * This test suite depends on running the compiler against the ./Resources/ThriftTest.thrift file:
+ * lib/php/test$ ../../../compiler/cpp/thrift --gen php -r  --out ./Resources/packages/php ./Resources/ThriftTest.thrift
  */
 class TSimpleJSONProtocolTest extends TestCase
 {
@@ -46,10 +39,10 @@
 
     public static function setUpBeforeClass()
     {
-
-        /** @var \Composer\Autoload\ClassLoader $loader */
-        $loader = require __DIR__ . '/../../../../vendor/autoload.php';
-        $loader->addPsr4('', __DIR__ . '/../packages/php');
+        $loader = new ThriftClassLoader();
+        $loader->registerNamespace('ThriftTest', __DIR__ . '/../Resources/packages/php');
+        $loader->registerDefinition('ThriftTest', __DIR__ . '/../Resources/packages/php');
+        $loader->register();
 
         Fixtures::populateTestArgs();
         TSimpleJSONProtocolFixtures::populateTestArgsSimpleJSON();
diff --git a/lib/php/test/Unit/ValidatorTest.php b/lib/php/test/Unit/ValidatorTest.php
new file mode 100644
index 0000000..06f6e55
--- /dev/null
+++ b/lib/php/test/Unit/ValidatorTest.php
@@ -0,0 +1,41 @@
+<?php
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+namespace Test\Thrift\Unit;
+
+use Thrift\ClassLoader\ThriftClassLoader;
+
+/***
+ * This test suite depends on running the compiler against the ./Resources/ThriftTest.thrift file:
+ * lib/php/test$ ../../../compiler/cpp/thrift --gen php:validate -r  --out ./Resources/packages/phpv ./Resources/ThriftTest.thrift
+ */
+class ValidatorTest extends BaseValidatorTest
+{
+    public function setUp()
+    {
+        $loader = new ThriftClassLoader();
+        $loader->registerNamespace('ThriftTest', __DIR__ . '/../Resources/packages/phpv');
+        $loader->registerDefinition('ThriftTest', __DIR__ . '/../Resources/packages/phpv');
+        $loader->registerNamespace('TestValidators', __DIR__ . '/../Resources/packages/phpv');
+        $loader->registerDefinition('TestValidators', __DIR__ . '/../Resources/packages/phpv');
+        $loader->register();
+    }
+}
diff --git a/lib/php/test/Unit/ValidatorTestOop.php b/lib/php/test/Unit/ValidatorTestOop.php
new file mode 100644
index 0000000..79da11e
--- /dev/null
+++ b/lib/php/test/Unit/ValidatorTestOop.php
@@ -0,0 +1,41 @@
+<?php
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+namespace Test\Thrift\Unit;
+
+use Thrift\ClassLoader\ThriftClassLoader;
+
+/***
+ * This test suite depends on running the compiler against the ./Resources/ThriftTest.thrift file:
+ * lib/php/test$ ../../../compiler/cpp/thrift --gen php:validate,oop -r --out ./Resources/packages/phpvo ./Resources/ThriftTest.thrift
+ */
+class ValidatorTestOop extends BaseValidatorTest
+{
+    public function setUp()
+    {
+        $loader = new ThriftClassLoader();
+        $loader->registerNamespace('ThriftTest', __DIR__ . '/../Resources/packages/phpvo');
+        $loader->registerDefinition('ThriftTest', __DIR__ . '/../Resources/packages/phpvo');
+        $loader->registerNamespace('TestValidators', __DIR__ . '/../Resources/packages/phpvo');
+        $loader->registerDefinition('TestValidators', __DIR__ . '/../Resources/packages/phpvo');
+        $loader->register();
+    }
+}
diff --git a/lib/php/test/Validator/ValidatorTest.php b/lib/php/test/Validator/ValidatorTest.php
deleted file mode 100644
index fa6c7a9..0000000
--- a/lib/php/test/Validator/ValidatorTest.php
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-namespace Test\Thrift;
-
-require __DIR__ . '/../../../../vendor/autoload.php';
-
-use Thrift\ClassLoader\ThriftClassLoader;
-
-/**
- * Class TestValidators
- * @package Test\Thrift
- *
- * @runTestsInSeparateProcesses
- */
-class ValidatorTest extends BaseValidatorTest
-{
-    public function setUp()
-    {
-        /** @var \Composer\Autoload\ClassLoader $loader */
-        $loader = require __DIR__ . '/../../../../vendor/autoload.php';
-        $loader->addPsr4('', __DIR__ . '/../packages/phpv');
-    }
-}
diff --git a/lib/php/test/Validator/ValidatorTestOop.php b/lib/php/test/Validator/ValidatorTestOop.php
deleted file mode 100644
index 93bca4d..0000000
--- a/lib/php/test/Validator/ValidatorTestOop.php
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-namespace Test\Thrift;
-
-require_once __DIR__ . '/../../../../vendor/autoload.php';
-
-use Thrift\ClassLoader\ThriftClassLoader;
-
-/**
- * Class TestValidatorsOop
- * @package Test\Thrift
- *
- * @runTestsInSeparateProcesses
- */
-class ValidatorTestOop extends BaseValidatorTest
-{
-    public function setUp()
-    {
-        /** @var \Composer\Autoload\ClassLoader $loader */
-        $loader = require __DIR__ . '/../../../../vendor/autoload.php';
-        $loader->addPsr4('', __DIR__ . '/../packages/phpvo');
-    }
-}