diff --git a/tests/src/TestContentEntityInterface.php b/tests/src/TestContentEntityInterface.php
deleted file mode 100644
index fcb7d272..00000000
--- a/tests/src/TestContentEntityInterface.php
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-
-namespace Drupal\Tests\search_api;
-
-use Drupal\Core\Entity\ContentEntityInterface;
-
-/**
- * Provides a testable version of \Drupal\Core\Entity\ContentEntityInterface.
- *
- * @see https://github.com/sebastianbergmann/phpunit-mock-objects/issues/103
- */
-interface TestContentEntityInterface extends \Iterator, ContentEntityInterface {
-}
diff --git a/tests/src/Unit/Plugin/Processor/AggregatedFieldsTest.php b/tests/src/Unit/Plugin/Processor/AggregatedFieldsTest.php
index ae589835..e8570adc 100644
--- a/tests/src/Unit/Plugin/Processor/AggregatedFieldsTest.php
+++ b/tests/src/Unit/Plugin/Processor/AggregatedFieldsTest.php
@@ -3,12 +3,17 @@
 namespace Drupal\Tests\search_api\Unit\Plugin\Processor;
 
 use Drupal\Core\TypedData\DataDefinition;
+use Drupal\Core\TypedData\TypedDataInterface;
+use Drupal\search_api\Datasource\DatasourceInterface;
+use Drupal\search_api\DataType\DataTypeInterface;
 use Drupal\search_api\Entity\Index;
+use Drupal\search_api\IndexInterface;
 use Drupal\search_api\Item\ItemInterface;
 use Drupal\search_api\Plugin\search_api\processor\AggregatedFields;
 use Drupal\search_api\Processor\ProcessorInterface;
 use Drupal\search_api\Processor\ProcessorProperty;
 use Drupal\search_api\Utility\Utility;
+use Drupal\Tests\search_api\Unit\TestComplexDataInterface;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -56,7 +61,7 @@ class AggregatedFieldsTest extends UnitTestCase {
   protected function setUp() {
     parent::setUp();
 
-    $datasource = $this->getMock('\Drupal\search_api\Datasource\DatasourceInterface');
+    $datasource = $this->getMock(DatasourceInterface::class);
     $datasource->expects($this->any())
       ->method('getPropertyDefinitions')
       ->willReturn(array());
@@ -106,7 +111,7 @@ protected function setUp() {
         return '*' . $value;
       }
     };
-    $data_type = $this->getMock('Drupal\search_api\DataType\DataTypeInterface');
+    $data_type = $this->getMock(DataTypeInterface::class);
     $data_type->method('getValue')
       ->willReturnCallback($this->valueCallback);
     $data_type_manager->method('createInstance')
@@ -269,7 +274,7 @@ public function testGetPropertyDefinitions() {
     $this->assertEquals($expected_description, $properties['aggregated_field']->getDescription(), 'Correct description set in the data definition.');
 
     // Verify that there are no properties if a datasource is given.
-    $datasource = $this->getMock('Drupal\search_api\Datasource\DatasourceInterface');
+    $datasource = $this->getMock(DatasourceInterface::class);
     $properties = $this->processor->getPropertyDefinitions($datasource);
     $this->assertEmpty($properties, 'Datasource-specific properties did not get changed.');
   }
@@ -278,14 +283,14 @@ public function testGetPropertyDefinitions() {
    * Tests that field extraction in the processor works correctly.
    */
   public function testFieldExtraction() {
-    /** @var \Drupal\Tests\search_api\TestComplexDataInterface|\PHPUnit_Framework_MockObject_MockObject $object */
-    $object = $this->getMock('Drupal\Tests\search_api\TestComplexDataInterface');
-    $bar_foo_property = $this->getMock('Drupal\Core\TypedData\TypedDataInterface');
+    /** @var \Drupal\Tests\search_api\Unit\TestComplexDataInterface|\PHPUnit_Framework_MockObject_MockObject $object */
+    $object = $this->getMock(TestComplexDataInterface::class);
+    $bar_foo_property = $this->getMock(TypedDataInterface::class);
     $bar_foo_property->method('getValue')
       ->willReturn('value3');
     $bar_foo_property->method('getDataDefinition')
       ->willReturn(new DataDefinition());
-    $bar_property = $this->getMock('Drupal\Tests\search_api\TestComplexDataInterface');
+    $bar_property = $this->getMock(TestComplexDataInterface::class);
     $bar_property->method('get')
       ->willReturnMap(array(
         array('foo', $bar_foo_property),
@@ -294,7 +299,7 @@ public function testFieldExtraction() {
       ->willReturn(array(
         'foo' => TRUE,
       ));
-    $foobar_property = $this->getMock('Drupal\Core\TypedData\TypedDataInterface');
+    $foobar_property = $this->getMock(TypedDataInterface::class);
     $foobar_property->method('getValue')
       ->willReturn('wrong_value2');
     $foobar_property->method('getDataDefinition')
@@ -311,7 +316,7 @@ public function testFieldExtraction() {
       ));
 
     /** @var \Drupal\search_api\IndexInterface|\PHPUnit_Framework_MockObject_MockObject $index */
-    $index = $this->getMock('Drupal\search_api\IndexInterface');
+    $index = $this->getMock(IndexInterface::class);
 
     $field = Utility::createField($index, 'aggregated_field', array(
       'property_path' => 'aggregated_field',
@@ -347,7 +352,7 @@ public function testFieldExtraction() {
           ),
         ),
       ));
-    $processor_mock = $this->getMock('Drupal\search_api\Processor\ProcessorInterface');
+    $processor_mock = $this->getMock(ProcessorInterface::class);
     $processor_mock->method('addFieldValues')
       ->willReturnCallback(function (ItemInterface $item) {
         foreach ($item->getFields(FALSE) as $field) {
@@ -369,7 +374,7 @@ public function testFieldExtraction() {
     $this->processor->setIndex($index);
 
     /** @var \Drupal\search_api\Datasource\DatasourceInterface|\PHPUnit_Framework_MockObject_MockObject $datasource */
-    $datasource = $this->getMock('Drupal\search_api\Datasource\DatasourceInterface');
+    $datasource = $this->getMock(DatasourceInterface::class);
     $datasource->method('getPluginId')
       ->willReturn('entity:test1');
 
diff --git a/tests/src/Unit/Plugin/Processor/HighlightTest.php b/tests/src/Unit/Plugin/Processor/HighlightTest.php
index ee169546..b017e741 100644
--- a/tests/src/Unit/Plugin/Processor/HighlightTest.php
+++ b/tests/src/Unit/Plugin/Processor/HighlightTest.php
@@ -3,6 +3,9 @@
 namespace Drupal\Tests\search_api\Unit\Plugin\Processor;
 
 use Drupal\Core\TypedData\DataDefinition;
+use Drupal\Core\TypedData\TypedDataInterface;
+use Drupal\search_api\Datasource\DatasourceInterface;
+use Drupal\search_api\IndexInterface;
 use Drupal\search_api\Item\Field;
 use Drupal\search_api\Item\ItemInterface;
 use Drupal\search_api\Plugin\search_api\processor\Highlight;
@@ -11,6 +14,7 @@
 use Drupal\search_api\Query\QueryInterface;
 use Drupal\search_api\Query\ResultSet;
 use Drupal\search_api\Utility\Utility;
+use Drupal\Tests\search_api\Unit\TestComplexDataInterface;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -48,7 +52,7 @@ protected function setUp() {
 
     $this->processor = new Highlight(array(), 'highlight', array());
 
-    $this->index = $this->getMock('Drupal\search_api\IndexInterface');
+    $this->index = $this->getMock(IndexInterface::class);
     $this->index->expects($this->any())
       ->method('getFulltextFields')
       ->willReturn(array('body', 'title'));
@@ -82,9 +86,9 @@ public function testFieldRenaming() {
    * Tests postprocessing with an empty result set.
    */
   public function testPostprocessSearchResultsWithEmptyResult() {
-    $query = $this->getMock('Drupal\search_api\Query\QueryInterface');
+    $query = $this->getMock(QueryInterface::class);
 
-    $results = $this->getMockBuilder('\Drupal\search_api\Query\ResultSet')
+    $results = $this->getMockBuilder(ResultSet::class)
       ->setMethods(array('getResultCount'))
       ->setConstructorArgs(array($query))
       ->getMock();
@@ -105,12 +109,12 @@ public function testPostprocessSearchResultsWithEmptyResult() {
    * Makes sure that queries with "basic" processing set are ignored.
    */
   public function testPostprocessBasicQuery() {
-    $query = $this->getMock('Drupal\search_api\Query\QueryInterface');
+    $query = $this->getMock(QueryInterface::class);
     $query->expects($this->once())
       ->method('getProcessingLevel')
       ->willReturn(QueryInterface::PROCESSING_BASIC);
 
-    $results = $this->getMockBuilder('Drupal\search_api\Query\ResultSet')
+    $results = $this->getMockBuilder(ResultSet::class)
       ->setMethods(array('getResultCount', 'getQuery'))
       ->setConstructorArgs(array($query))
       ->getMock();
@@ -134,12 +138,12 @@ public function testPostprocessBasicQuery() {
    * Tests postprocessing on a query without keywords.
    */
   public function testPostprocessSearchResultsWithoutKeywords() {
-    $query = $this->getMock('Drupal\search_api\Query\QueryInterface');
+    $query = $this->getMock(QueryInterface::class);
     $query->expects($this->once())
       ->method('getProcessingLevel')
       ->willReturn(QueryInterface::PROCESSING_FULL);
 
-    $results = $this->getMockBuilder('Drupal\search_api\Query\ResultSet')
+    $results = $this->getMockBuilder(ResultSet::class)
       ->setMethods(array('getResultCount', 'getQuery'))
       ->setConstructorArgs(array($query))
       ->getMock();
@@ -165,7 +169,7 @@ public function testPostprocessSearchResultsWithoutKeywords() {
    * Tests field highlighting with a normal result set.
    */
   public function testPostprocessSearchResultsWithResults() {
-    $query = $this->getMock('Drupal\search_api\Query\QueryInterface');
+    $query = $this->getMock(QueryInterface::class);
     $query->expects($this->once())
       ->method('getProcessingLevel')
       ->willReturn(QueryInterface::PROCESSING_FULL);
@@ -211,7 +215,7 @@ public function testPostprocessSearchResultsWithChangedPrefixSuffix() {
       'suffix' => '</em>',
     ));
 
-    $query = $this->getMock('Drupal\search_api\Query\QueryInterface');
+    $query = $this->getMock(QueryInterface::class);
     $query->expects($this->once())
       ->method('getProcessingLevel')
       ->willReturn(QueryInterface::PROCESSING_FULL);
@@ -254,7 +258,7 @@ public function testPostprocessSearchResultsWithChangedPrefixSuffix() {
   public function testPostprocessSearchResultsWithoutHighlight() {
     $this->processor->setConfiguration(array('highlight' => 'never'));
 
-    $query = $this->getMock('Drupal\search_api\Query\QueryInterface');
+    $query = $this->getMock(QueryInterface::class);
     $query->expects($this->once())
       ->method('getProcessingLevel')
       ->willReturn(QueryInterface::PROCESSING_FULL);
@@ -297,7 +301,7 @@ public function testPostprocessSearchResultsWithoutHighlight() {
   public function testPostprocessSearchResultsHighlightPartial() {
     $this->processor->setConfiguration(array('highlight_partial' => TRUE));
 
-    $query = $this->getMock('Drupal\search_api\Query\QueryInterface');
+    $query = $this->getMock(QueryInterface::class);
     $query->expects($this->once())
       ->method('getProcessingLevel')
       ->willReturn(QueryInterface::PROCESSING_FULL);
@@ -338,7 +342,7 @@ public function testPostprocessSearchResultsHighlightPartial() {
    * Tests field highlighting when previous highlighting is present.
    */
   public function testPostprocessSearchResultsWithPreviousHighlighting() {
-    $query = $this->getMock('Drupal\search_api\Query\QueryInterface');
+    $query = $this->getMock(QueryInterface::class);
     $query->expects($this->once())
       ->method('getProcessingLevel')
       ->willReturn(QueryInterface::PROCESSING_FULL);
@@ -384,7 +388,7 @@ public function testPostprocessSearchResultsWithPreviousHighlighting() {
    * Tests whether highlighting works on a longer text.
    */
   public function testPostprocessSearchResultsExcerpt() {
-    $query = $this->getMock('Drupal\search_api\Query\QueryInterface');
+    $query = $this->getMock(QueryInterface::class);
     $query->expects($this->once())
       ->method('getProcessingLevel')
       ->willReturn(QueryInterface::PROCESSING_FULL);
@@ -427,7 +431,7 @@ public function testPostprocessSearchResultsExcerpt() {
    * Tests whether highlighting works on a longer text matching near the end.
    */
   public function testPostprocessSearchResultsExerptMatchNearEnd() {
-    $query = $this->getMock('Drupal\search_api\Query\QueryInterface');
+    $query = $this->getMock(QueryInterface::class);
     $query->expects($this->once())
       ->method('getProcessingLevel')
       ->willReturn(QueryInterface::PROCESSING_FULL);
@@ -472,7 +476,7 @@ public function testPostprocessSearchResultsExerptMatchNearEnd() {
   public function testPostprocessSearchResultsWithChangedExcerptLength() {
     $this->processor->setConfiguration(array('excerpt_length' => 64));
 
-    $query = $this->getMock('Drupal\search_api\Query\QueryInterface');
+    $query = $this->getMock(QueryInterface::class);
     $query->expects($this->once())
       ->method('getProcessingLevel')
       ->willReturn(QueryInterface::PROCESSING_FULL);
@@ -517,7 +521,7 @@ public function testPostprocessSearchResultsWithChangedExcerptLength() {
   public function testPostprocessSearchResultsWithoutExcerpt() {
     $this->processor->setConfiguration(array('excerpt' => FALSE));
 
-    $query = $this->getMock('Drupal\search_api\Query\QueryInterface');
+    $query = $this->getMock(QueryInterface::class);
     $query->expects($this->once())
       ->method('getProcessingLevel')
       ->willReturn(QueryInterface::PROCESSING_FULL);
@@ -574,7 +578,7 @@ public function testPostprocessSearchResultsWithComplexKeys() {
         'will',
       ),
     );
-    $query = $this->getMock('Drupal\search_api\Query\QueryInterface');
+    $query = $this->getMock(QueryInterface::class);
     $query->expects($this->once())
       ->method('getProcessingLevel')
       ->willReturn(QueryInterface::PROCESSING_FULL);
@@ -619,7 +623,7 @@ public function testPostprocessSearchResultsWithComplexKeys() {
    * Tests field highlighting and excerpts for two fields.
    */
   public function testPostprocessSearchResultsWithTwoFields() {
-    $query = $this->getMock('Drupal\search_api\Query\QueryInterface');
+    $query = $this->getMock(QueryInterface::class);
     $query->expects($this->once())
       ->method('getProcessingLevel')
       ->willReturn(QueryInterface::PROCESSING_FULL);
@@ -677,7 +681,7 @@ public function testPostprocessSearchResultsWithTwoFields() {
    * Tests field highlighting and excerpts with two items.
    */
   public function testPostprocessSearchResultsWithTwoItems() {
-    $query = $this->getMock('Drupal\search_api\Query\QueryInterface');
+    $query = $this->getMock(QueryInterface::class);
     $query->expects($this->once())
       ->method('getProcessingLevel')
       ->willReturn(QueryInterface::PROCESSING_FULL);
@@ -728,7 +732,7 @@ public function testPostprocessSearchResultsWithTwoItems() {
    * Tests excerpts with some fields excluded.
    */
   public function testExcerptExcludeFields() {
-    $query = $this->getMock('Drupal\search_api\Query\QueryInterface');
+    $query = $this->getMock(QueryInterface::class);
     $query->expects($this->once())
       ->method('getProcessingLevel')
       ->willReturn(QueryInterface::PROCESSING_FULL);
@@ -787,14 +791,14 @@ public function testExcerptExcludeFields() {
    * Tests that field extraction in the processor works correctly.
    */
   public function testFieldExtraction() {
-    /** @var \Drupal\Tests\search_api\TestComplexDataInterface|\PHPUnit_Framework_MockObject_MockObject $object */
-    $object = $this->getMock('Drupal\Tests\search_api\TestComplexDataInterface');
-    $bar_foo_property = $this->getMock('Drupal\Core\TypedData\TypedDataInterface');
+    /** @var \Drupal\Tests\search_api\Unit\TestComplexDataInterface|\PHPUnit_Framework_MockObject_MockObject $object */
+    $object = $this->getMock(TestComplexDataInterface::class);
+    $bar_foo_property = $this->getMock(TypedDataInterface::class);
     $bar_foo_property->method('getValue')
       ->willReturn('value3 foo');
     $bar_foo_property->method('getDataDefinition')
       ->willReturn(new DataDefinition());
-    $bar_property = $this->getMock('Drupal\Tests\search_api\TestComplexDataInterface');
+    $bar_property = $this->getMock(TestComplexDataInterface::class);
     $bar_property->method('get')
       ->willReturnMap(array(
         array('foo', $bar_foo_property),
@@ -803,7 +807,7 @@ public function testFieldExtraction() {
       ->willReturn(array(
         'foo' => TRUE,
       ));
-    $foobar_property = $this->getMock('Drupal\Core\TypedData\TypedDataInterface');
+    $foobar_property = $this->getMock(TypedDataInterface::class);
     $foobar_property->method('getValue')
       ->willReturn('wrong_value2 foo');
     $foobar_property->method('getDataDefinition')
@@ -845,7 +849,7 @@ public function testFieldExtraction() {
           ),
         ),
       ));
-    $processor_mock = $this->getMock('Drupal\search_api\Processor\ProcessorInterface');
+    $processor_mock = $this->getMock(ProcessorInterface::class);
     $processor_mock->method('addFieldValues')
       ->willReturnCallback(function (ItemInterface $item) {
         foreach ($item->getFields(FALSE) as $field) {
@@ -867,7 +871,7 @@ public function testFieldExtraction() {
     $this->processor->setIndex($this->index);
 
     /** @var \Drupal\search_api\Datasource\DatasourceInterface|\PHPUnit_Framework_MockObject_MockObject $datasource */
-    $datasource = $this->getMock('Drupal\search_api\Datasource\DatasourceInterface');
+    $datasource = $this->getMock(DatasourceInterface::class);
     $datasource->method('getPluginId')
       ->willReturn('entity:test1');
 
@@ -883,7 +887,7 @@ public function testFieldExtraction() {
 
     $this->processor->setConfiguration(array('excerpt' => FALSE));
     /** @var \Drupal\search_api\Query\QueryInterface|\PHPUnit_Framework_MockObject_MockObject $query */
-    $query = $this->getMock('Drupal\search_api\Query\QueryInterface');
+    $query = $this->getMock(QueryInterface::class);
     $query->method('getKeys')
       ->willReturn('foo');
     $query->expects($this->once())
diff --git a/tests/src/Unit/Plugin/Processor/NodeStatusTest.php b/tests/src/Unit/Plugin/Processor/NodeStatusTest.php
index a1abf22a..310c8ea5 100644
--- a/tests/src/Unit/Plugin/Processor/NodeStatusTest.php
+++ b/tests/src/Unit/Plugin/Processor/NodeStatusTest.php
@@ -3,8 +3,11 @@
 namespace Drupal\Tests\search_api\Unit\Plugin\Processor;
 
 use Drupal\Core\Entity\Plugin\DataType\EntityAdapter;
+use Drupal\search_api\Datasource\DatasourceInterface;
+use Drupal\search_api\IndexInterface;
 use Drupal\search_api\Plugin\search_api\processor\NodeStatus;
 use Drupal\search_api\Utility\Utility;
+use Drupal\Tests\search_api\Unit\TestNodeInterface;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -42,20 +45,20 @@ protected function setUp() {
 
     $this->processor = new NodeStatus(array(), 'node_status', array());
 
-    $datasource = $this->getMock('Drupal\search_api\Datasource\DatasourceInterface');
+    $datasource = $this->getMock(DatasourceInterface::class);
     $datasource->expects($this->any())
       ->method('getEntityTypeId')
       ->will($this->returnValue('node'));
     /** @var \Drupal\search_api\Datasource\DatasourceInterface $datasource */
 
     /** @var \Drupal\search_api\IndexInterface|\PHPUnit_Framework_MockObject_MockObject $index */
-    $index = $this->getMock('Drupal\search_api\IndexInterface');
+    $index = $this->getMock(IndexInterface::class);
     $index->expects($this->any())
       ->method('getDatasources')
       ->will($this->returnValue(array($datasource)));
 
     $item = Utility::createItem($index, Utility::createCombinedId('entity:node', '1:en'), $datasource);
-    $unpublished_node = $this->getMockBuilder('Drupal\Tests\search_api\TestNodeInterface')
+    $unpublished_node = $this->getMockBuilder(TestNodeInterface::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -68,7 +71,7 @@ protected function setUp() {
     $this->items[$item->getId()] = $item;
 
     $item = Utility::createItem($index, Utility::createCombinedId('entity:node', '2:en'), $datasource);
-    $published_node = $this->getMockBuilder('Drupal\Tests\search_api\TestNodeInterface')
+    $published_node = $this->getMockBuilder(TestNodeInterface::class)
       ->disableOriginalConstructor()
       ->getMock();
 
@@ -93,7 +96,7 @@ public function testSupportsIndexSupported() {
    * Tests whether supportsIndex() returns FALSE for an index without nodes.
    */
   public function testSupportsIndexUnsupported() {
-    $index = $this->getMock('Drupal\search_api\IndexInterface');
+    $index = $this->getMock(IndexInterface::class);
     $index->expects($this->any())
       ->method('getDatasources')
       ->will($this->returnValue(array()));
diff --git a/tests/src/Unit/Plugin/Processor/RoleFilterTest.php b/tests/src/Unit/Plugin/Processor/RoleFilterTest.php
index 1f0d1a4f..ec75645e 100644
--- a/tests/src/Unit/Plugin/Processor/RoleFilterTest.php
+++ b/tests/src/Unit/Plugin/Processor/RoleFilterTest.php
@@ -3,8 +3,11 @@
 namespace Drupal\Tests\search_api\Unit\Plugin\Processor;
 
 use Drupal\Core\Entity\Plugin\DataType\EntityAdapter;
+use Drupal\search_api\Datasource\DatasourceInterface;
 use Drupal\search_api\Plugin\search_api\processor\RoleFilter;
 use Drupal\search_api\Utility\Utility;
+use Drupal\Tests\search_api\Unit\TestNodeInterface;
+use Drupal\Tests\search_api\Unit\TestUserInterface;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -45,19 +48,19 @@ protected function setUp() {
     /** @var \Drupal\search_api\IndexInterface $index */
     $index = $this->getMock('Drupal\search_api\IndexInterface');
 
-    $node_datasource = $this->getMock('Drupal\search_api\Datasource\DatasourceInterface');
+    $node_datasource = $this->getMock(DatasourceInterface::class);
     $node_datasource->expects($this->any())
       ->method('getEntityTypeId')
       ->will($this->returnValue('node'));
     /** @var \Drupal\search_api\Datasource\DatasourceInterface $node_datasource */
-    $user_datasource = $this->getMock('Drupal\search_api\Datasource\DatasourceInterface');
+    $user_datasource = $this->getMock(DatasourceInterface::class);
     $user_datasource->expects($this->any())
       ->method('getEntityTypeId')
       ->will($this->returnValue('user'));
     /** @var \Drupal\search_api\Datasource\DatasourceInterface $user_datasource */
 
     $item = Utility::createItem($index, Utility::createCombinedId('entity:node', '1:en'), $node_datasource);
-    $node = $this->getMockBuilder('Drupal\Tests\search_api\TestNodeInterface')
+    $node = $this->getMockBuilder(TestNodeInterface::class)
       ->disableOriginalConstructor()
       ->getMock();
     /** @var \Drupal\node\NodeInterface $node */
@@ -65,7 +68,7 @@ protected function setUp() {
     $this->items[$item->getId()] = $item;
 
     $item = Utility::createItem($index, Utility::createCombinedId('entity:user', '1:en'), $user_datasource);
-    $account1 = $this->getMockBuilder('Drupal\Tests\search_api\TestUserInterface')
+    $account1 = $this->getMockBuilder(TestUserInterface::class)
       ->disableOriginalConstructor()
       ->getMock();
     $account1->expects($this->any())
@@ -76,7 +79,7 @@ protected function setUp() {
     $this->items[$item->getId()] = $item;
 
     $item = Utility::createItem($index, Utility::createCombinedId('entity:user', '2:en'), $user_datasource);
-    $account2 = $this->getMockBuilder('Drupal\Tests\search_api\TestUserInterface')
+    $account2 = $this->getMockBuilder(TestUserInterface::class)
       ->disableOriginalConstructor()
       ->getMock();
     $account2->expects($this->any())
diff --git a/tests/src/TestComplexDataInterface.php b/tests/src/Unit/TestComplexDataInterface.php
similarity index 88%
rename from tests/src/TestComplexDataInterface.php
rename to tests/src/Unit/TestComplexDataInterface.php
index a9ee0c83..003a696e 100644
--- a/tests/src/TestComplexDataInterface.php
+++ b/tests/src/Unit/TestComplexDataInterface.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\Tests\search_api;
+namespace Drupal\Tests\search_api\Unit;
 
 use Drupal\Core\TypedData\ComplexDataInterface;
 
diff --git a/tests/src/TestNodeInterface.php b/tests/src/Unit/TestNodeInterface.php
similarity index 86%
rename from tests/src/TestNodeInterface.php
rename to tests/src/Unit/TestNodeInterface.php
index c3cf4180..10d0e1e7 100644
--- a/tests/src/TestNodeInterface.php
+++ b/tests/src/Unit/TestNodeInterface.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\Tests\search_api;
+namespace Drupal\Tests\search_api\Unit;
 
 use Drupal\node\NodeInterface;
 
diff --git a/tests/src/TestUserInterface.php b/tests/src/Unit/TestUserInterface.php
similarity index 86%
rename from tests/src/TestUserInterface.php
rename to tests/src/Unit/TestUserInterface.php
index 010c9c84..6b952cbf 100644
--- a/tests/src/TestUserInterface.php
+++ b/tests/src/Unit/TestUserInterface.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\Tests\search_api;
+namespace Drupal\Tests\search_api\Unit;
 
 use Drupal\user\UserInterface;
 
