Skip to content

Commit

Permalink
refactor: remove CodeIgniter\Services
Browse files Browse the repository at this point in the history
It seems it is not needed.
  • Loading branch information
kenjis committed May 31, 2022
1 parent 0c66d6b commit d777cee
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 81 deletions.
5 changes: 0 additions & 5 deletions system/Test/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,6 @@
require_once SYSTEMPATH . 'Config/Services.php';
require_once APPPATH . 'Config/Services.php';

// Use Config\Services as CodeIgniter\Services
if (! class_exists('CodeIgniter\Services', false)) {
class_alias(Services::class, 'CodeIgniter\Services');
}

// Initialize and register the loader with the SPL autoloader stack.
Services::autoloader()->initialize(new Autoload(), new Modules())->register();

Expand Down
5 changes: 0 additions & 5 deletions system/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,6 @@
require_once SYSTEMPATH . 'Config/Services.php';
require_once APPPATH . 'Config/Services.php';

// Use Config\Services as CodeIgniter\Services
if (! class_exists('CodeIgniter\Services', false)) {
class_alias(Services::class, 'CodeIgniter\Services');
}

// Initialize and register the loader with the SPL autoloader stack.
Services::autoloader()->initialize(new Autoload(), new Modules())->register();

Expand Down
66 changes: 0 additions & 66 deletions tests/_support/Services.php

This file was deleted.

6 changes: 3 additions & 3 deletions tests/system/CommonFunctionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
namespace CodeIgniter;

use CodeIgniter\Config\BaseService;
use CodeIgniter\Config\Services;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\Response;
use CodeIgniter\HTTP\URI;
Expand All @@ -29,6 +28,7 @@
use Config\App;
use Config\Logger;
use Config\Modules;
use Config\Services;
use Kint;
use stdClass;
use Tests\Support\Models\JobModel;
Expand Down Expand Up @@ -118,8 +118,8 @@ public function testRedirectReturnsRedirectResponse()
Services::locator(),
new Modules()
);
\CodeIgniter\Services::injectMock('response', $response);
\CodeIgniter\Services::injectMock('routes', $routes);
Services::injectMock('response', $response);
Services::injectMock('routes', $routes);

$routes->add('home/base', 'Controller::index', ['as' => 'base']);
$response->method('redirect')->willReturnArgument(0);
Expand Down
1 change: 1 addition & 0 deletions tests/system/ControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use CodeIgniter\Test\CIUnitTestCase;
use CodeIgniter\Validation\Exceptions\ValidationException;
use Config\App;
use Config\Services;
use Psr\Log\LoggerInterface;

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Helpers/FormHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
namespace CodeIgniter\Helpers;

use CodeIgniter\HTTP\URI;
use CodeIgniter\Services;
use CodeIgniter\Test\CIUnitTestCase;
use Config\App;
use Config\Filters;
use Config\Services;

/**
* @internal
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Log/Handlers/ChromeLoggerHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@

namespace CodeIgniter\Log\Handlers;

use CodeIgniter\Services;
use CodeIgniter\Test\CIUnitTestCase;
use CodeIgniter\Test\Mock\MockLogger as LoggerConfig;
use CodeIgniter\Test\Mock\MockResponse;
use Config\App;
use Config\Services;
use stdClass;

/**
Expand Down

0 comments on commit d777cee

Please sign in to comment.