<?php
namespace BryanCrowe\ApiPagination\Test;

use BryanCrowe\ApiPagination\Controller\Component\ApiPaginationComponent;
use Cake\Controller\ComponentRegistry;
use Cake\Controller\Controller;
use Cake\Core\Plugin;
use Cake\Event\Event;
use Cake\Network\Request;
use Cake\Network\Response;
use Cake\TestSuite\TestCase;

/**
 * ApiPaginationComponentTest class
 */
class ApiPaginationComponentTest extends TestCase
{
    /**
     * setUp method
     *
     * @return void
     */
    public function setUp()
    {
        parent::setUp();
    }

    /**
     * tearDown method
     *
     * @return void
     */
    public function tearDown()
    {
        parent::tearDown();
    }

    public function testNonApiPaginatedRequest()
    {
        $request = new Request('/');
        $response = $this->getMock('Cake\Network\Response');
        $controller = new Controller($request, $response);
        $apiPaginationComponent = new ApiPaginationComponent($controller->components());
        $event = new Event('Controller.beforeRender', $controller);

        $this->assertNull($apiPaginationComponent->beforeRender($event));
    }
}

<?php
namespace BryanCrowe\ApiPagination\Test;

use BryanCrowe\ApiPagination\Controller\Component\ApiPaginationComponent;
use Cake\Controller\ComponentRegistry;
use Cake\Controller\Controller;
use Cake\Core\Plugin;
use Cake\Network\Request;
use Cake\Network\Response;
use Cake\TestSuite\TestCase;

/**
 * ApiPaginationComponentTest class
 */
class ApiPaginationComponentTest extends TestCase
{
    /**
     * setUp method
     *
     * @return void
     */
    public function setUp()
    {
        parent::setUp();
    }

    /**
     * tearDown method
     *
     * @return void
     */
    public function tearDown()
    {
        parent::tearDown();

        unset($this->component, $this->controller);
    }

    public function testInit()
    {
        $request = new Request('/');
        $response = $this->getMock('Cake\Network\Response');

        $controller = new Controller($request, $response);
        $controller->loadComponent('BryanCrowe/ApiPagination.ApiPagination');

        $expected = [
            'key' => 'pagination',
            'aliases' => [],
            'visible' => []
        ];

        $result = $controller->ApiPagination->config();

        $this->assertSame($expected, $result);
    }
}

--- 
+++ 
@@ -5,6 +5,7 @@
 use Cake\Controller\ComponentRegistry;
 use Cake\Controller\Controller;
 use Cake\Core\Plugin;
+use Cake\Event\Event;
 use Cake\Network\Request;
 use Cake\Network\Response;
 use Cake\TestSuite\TestCase;
@@ -32,26 +33,16 @@
     public function tearDown()
     {
         parent::tearDown();
-
-        unset($this->component, $this->controller);
     }
 
-    public function testInit()
+    public function testNonApiPaginatedRequest()
     {
         $request = new Request('/');
         $response = $this->getMock('Cake\Network\Response');
+        $controller = new Controller($request, $response);
+        $apiPaginationComponent = new ApiPaginationComponent($controller->components());
+        $event = new Event('Controller.beforeRender', $controller);
 
-        $controller = new Controller($request, $response);
-        $controller->loadComponent('BryanCrowe/ApiPagination.ApiPagination');
-
-        $expected = [
-            'key' => 'pagination',
-            'aliases' => [],
-            'visible' => []
-        ];
-
-        $result = $controller->ApiPagination->config();
-
-        $this->assertSame($expected, $result);
+        $this->assertNull($apiPaginationComponent->beforeRender($event));
     }
 }
Remove old test code, test non API paginated request early return
