Skip to content

Commit 990024b

Browse files
committed
Merge remote-tracking branch 'origin/master' into cake5
# Conflicts: # .github/workflows/ci.yml
2 parents e0e62ae + 44545e9 commit 990024b

File tree

14 files changed

+124
-57
lines changed

14 files changed

+124
-57
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,9 @@ jobs:
5252
uses: actions/cache@v3
5353
with:
5454
path: ${{ steps.composercache.outputs.dir }}
55-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
56-
restore-keys: ${{ runner.os }}-composer-
55+
key: ${{ runner.os }}-composer-${{ steps.key-date.outputs.date }}-${{ hashFiles('composer.json') }}-${{ matrix.prefer-lowest }}
5756

58-
- name: Composer install --no-progress --prefer-dist --optimize-autoloader
57+
- name: Composer install
5958
run: |
6059
composer --version
6160
if ${{ matrix.prefer-lowest == 'prefer-lowest' }}
@@ -104,8 +103,7 @@ jobs:
104103
uses: actions/cache@v3
105104
with:
106105
path: ${{ steps.composercache.outputs.dir }}
107-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
108-
restore-keys: ${{ runner.os }}-composer-
106+
key: ${{ runner.os }}-composer-${{ steps.key-date.outputs.date }}-${{ hashFiles('composer.json') }}-${{ matrix.prefer-lowest }}
109107

110108
- name: Composer Install
111109
run: composer stan-setup

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"cakephp/authorization": "3.x-dev",
3030
"fig-r/psr2r-sniffer": "dev-next",
3131
"composer/semver": "^3.0",
32-
"phpunit/phpunit": "^9.5"
32+
"phpunit/phpunit": "^10.2"
3333
},
3434
"support": {
3535
"source": "https://github.com/dereuromark/cakephp-tinyauth"

phpunit.xml.dist

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,14 @@
1212
</testsuite>
1313
</testsuites>
1414

15-
<listeners>
16-
<listener class="Cake\TestSuite\Fixture\FixtureInjector">
17-
<arguments>
18-
<object class="Cake\TestSuite\Fixture\FixtureManager"/>
19-
</arguments>
20-
</listener>
21-
</listeners>
15+
<extensions>
16+
<bootstrap class="\Cake\TestSuite\Fixture\Extension\PHPUnitExtension"/>
17+
</extensions>
2218

23-
<filter>
24-
<whitelist>
19+
<source>
20+
<include>
2521
<directory suffix=".php">src/</directory>
26-
</whitelist>
27-
</filter>
22+
</include>
23+
</source>
2824

2925
</phpunit>

src/Controller/Component/AuthUserComponent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class AuthUserComponent extends Component {
2424
/**
2525
* @var array
2626
*/
27-
protected array $components = ['Auth'];
27+
protected array $components = ['TinyAuth.Auth'];
2828

2929
/**
3030
* @param \Cake\Controller\ComponentRegistry $registry

src/Plugin.php renamed to src/TinyAuthPlugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
/**
88
* Plugin for TinyAuth
99
*/
10-
class Plugin extends BasePlugin {
10+
class TinyAuthPlugin extends BasePlugin {
1111

1212
/**
1313
* @var bool

tests/TestCase/Command/TinyAuthSyncCommandTest.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
namespace TinyAuth\Test\TestCase\Command;
44

5-
use Cake\Console\Command;
5+
use Cake\Command\Command;
6+
use Cake\Console\TestSuite\ConsoleIntegrationTestTrait;
67
use Cake\Core\Configure;
7-
use Cake\Filesystem\Folder;
8-
use Cake\TestSuite\ConsoleIntegrationTestCase;
8+
use Cake\TestSuite\TestCase;
99

10-
class TinyAuthSyncCommandTest extends ConsoleIntegrationTestCase {
10+
class TinyAuthSyncCommandTest extends TestCase {
11+
12+
use ConsoleIntegrationTestTrait;
1113

1214
/**
1315
* setup method
@@ -34,8 +36,8 @@ public function testSync() {
3436
Configure::write('TinyAuth.aclFilePath', TESTS . 'test_files/subfolder/');
3537
Configure::write('TinyAuth.allowFilePath', TESTS . 'test_files/');
3638

37-
$folder = new Folder();
38-
$folder->copy('/tmp' . DS . 'src' . DS . 'Controller' . DS, ['from' => TESTS . 'test_app' . DS . 'Controller' . DS]);
39+
//$folder = new Folder();
40+
//$folder->copy('/tmp' . DS . 'src' . DS . 'Controller' . DS, ['from' => TESTS . 'test_app' . DS . 'Controller' . DS]);
3941

4042
$this->exec('tiny_auth_sync foo,bar -d -v');
4143

tests/TestCase/Controller/Component/AuthComponentTest.php

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
use Cake\Event\Event;
99
use Cake\Http\Response;
1010
use Cake\Http\ServerRequest;
11+
use Cake\Routing\Route\DashedRoute;
12+
use Cake\Routing\RouteBuilder;
13+
use Cake\Routing\Router;
1114
use Cake\TestSuite\TestCase;
1215
use TestApp\Controller\Admin\MyPrefix\MyTestController;
1316
use TestApp\Controller\OffersController;
@@ -33,6 +36,12 @@ public function setUp(): void {
3336
'allowFilePath' => Plugin::path('TinyAuth') . 'tests' . DS . 'test_files' . DS,
3437
'autoClearCache' => true,
3538
];
39+
40+
$builder = Router::createRouteBuilder('/');
41+
$builder->setRouteClass(DashedRoute::class);
42+
$builder->scope('/', function (RouteBuilder $routes): void {
43+
$routes->fallbacks();
44+
});
3645
}
3746

3847
/**
@@ -117,13 +126,14 @@ public function testDeniedActionInController() {
117126
*/
118127
public function testDeniedAction() {
119128
$request = new ServerRequest([
120-
'params' => [
121-
'plugin' => 'Extras',
122-
'controller' => 'Offers',
123-
'action' => 'superPrivate',
124-
'_ext' => null,
125-
'pass' => [1],
126-
]]);
129+
'params' => [
130+
'plugin' => 'Extras',
131+
'controller' => 'Offers',
132+
'action' => 'superPrivate',
133+
'_ext' => null,
134+
'pass' => [1],
135+
],
136+
]);
127137
$controller = new OffersController($request);
128138
$controller->loadComponent('TinyAuth.Auth', $this->componentConfig);
129139

@@ -223,7 +233,7 @@ public function testInvalid() {
223233
protected function getControllerMock(ServerRequest $request) {
224234
$controller = $this->getMockBuilder(Controller::class)
225235
->setConstructorArgs([$request])
226-
->setMethods(['isAction'])
236+
->onlyMethods(['isAction'])
227237
->getMock();
228238

229239
$controller->expects($this->once())->method('isAction')->willReturn(true);

tests/TestCase/Controller/Component/AuthUserComponentTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace TinyAuth\Test\TestCase\Controller\Component;
44

5-
use Cake\Controller\Component\AuthComponent;
65
use Cake\Controller\ComponentRegistry;
76
use Cake\Controller\Controller;
87
use Cake\Core\Configure;
@@ -33,7 +32,7 @@ public function setUp(): void {
3332
$controller = new Controller(new ServerRequest());
3433
$componentRegistry = new ComponentRegistry($controller);
3534
$this->AuthUser = new TestAuthUserComponent($componentRegistry);
36-
$this->AuthUser->Auth = $this->getMockBuilder(AuthComponent::class)->setMethods(['user'])->setConstructorArgs([$componentRegistry])->getMock();
35+
//$this->AuthUser->Auth = $this->getMockBuilder(AuthComponent::class)->onlyMethods(['user'])->setConstructorArgs([$componentRegistry])->getMock();
3736

3837
Configure::write('Roles', [
3938
'user' => 1,

tests/TestCase/Controller/Component/AuthenticationComponentTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ public function testIsPublicAllowPrefixedFail() {
175175
protected function getControllerMock(ServerRequest $request) {
176176
$controller = $this->getMockBuilder(Controller::class)
177177
->setConstructorArgs([$request])
178-
->setMethods(['isAction'])
178+
->onlyMethods(['isAction'])
179179
->getMock();
180180

181181
$controller->expects($this->any())->method('isAction')->willReturn(true);

tests/TestCase/Panel/AuthPanelTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function tearDown(): void {
6060
* @return void
6161
*/
6262
public function testPanelRestrictedAction() {
63-
$controller = new Controller();
63+
$controller = new Controller(new ServerRequest());
6464
$event = new Event('event', $controller);
6565

6666
$this->panel->shutdown($event);

0 commit comments

Comments
 (0)