diff --git a/.gitattributes b/.gitattributes
index 36c9aa1..8da302f 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -3,7 +3,7 @@
.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
-phpcs.xml.dist export-ignore
+phpcs.xml export-ignore
phpstan.neon export-ignore
phpstan-baseline.neon export-ignore
phpunit.xml.dist export-ignore
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 2fcf09e..356a5ff 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -8,95 +8,14 @@ on:
branches:
- '*'
+permissions:
+ contents: read
+
jobs:
testsuite:
- runs-on: ubuntu-20.04
- strategy:
- fail-fast: false
- matrix:
- php-version: ['7.4', '8.0', '8.1']
- db-type: [sqlite, mysql, pgsql]
- prefer-lowest: ['']
- include:
- - php-version: '7.2'
- db-type: 'sqlite'
- prefer-lowest: 'prefer-lowest'
-
- services:
- postgres:
- image: postgres
- ports:
- - 5432:5432
- env:
- POSTGRES_PASSWORD: postgres
-
- steps:
- - uses: actions/checkout@v3
-
- - name: Setup Service
- if: matrix.db-type == 'mysql'
- run: |
- sudo service mysql start
- mysql -h 127.0.0.1 -u root -proot -e 'CREATE DATABASE cakephp;'
-
- - name: Setup PHP
- uses: shivammathur/setup-php@v2
- with:
- php-version: ${{ matrix.php-version }}
- extensions: mbstring, intl, pdo_${{ matrix.db-type }}
- coverage: pcov
-
- - name: Composer install
- run: |
- if ${{ matrix.prefer-lowest == 'prefer-lowest' }}; then
- composer update --prefer-lowest --prefer-stable
- else
- composer install
- fi
-
- - name: Setup problem matchers for PHPUnit
- run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
-
- - name: Run PHPUnit
- run: |
- if [[ ${{ matrix.db-type }} == 'sqlite' ]]; then export DB_URL='sqlite:///:memory:'; fi
- if [[ ${{ matrix.db-type }} == 'mysql' ]]; then export DB_URL='mysql://root:root@127.0.0.1/cakephp'; fi
- if [[ ${{ matrix.db-type }} == 'pgsql' ]]; then export DB_URL='postgres://postgres:postgres@127.0.0.1/postgres'; fi
- if [[ ${{ matrix.php-version }} == '7.4' ]]; then
- vendor/bin/phpunit --coverage-clover=coverage.xml
- else
- vendor/bin/phpunit
- fi
-
- - name: Code Coverage Report
- if: success() && matrix.php-version == '7.4'
- uses: codecov/codecov-action@v3
+ uses: ADmad/.github/.github/workflows/testsuite-with-db.yml@master
+ secrets: inherit
cs-stan:
- name: Coding Standard & Static Analysis
- runs-on: ubuntu-20.04
-
- steps:
- - uses: actions/checkout@v3
-
- - name: Setup PHP
- uses: shivammathur/setup-php@v2
- with:
- php-version: '7.4'
- extensions: mbstring, intl
- coverage: none
- tools: cs2pr, vimeo/psalm:4, phpstan:1
-
- - name: Composer Install
- run: composer install
-
- - name: Run phpcs
- run: vendor/bin/phpcs -q --report=checkstyle --standard=vendor/cakephp/cakephp-codesniffer/CakePHP src/ tests/ | cs2pr
-
- - name: Run psalm
- if: always()
- run: psalm --output-format=github
-
- - name: Run psalm
- if: always()
- run: phpstan analyse
+ uses: ADmad/.github/.github/workflows/cs-stan.yml@master
+ secrets: inherit
diff --git a/.gitignore b/.gitignore
index 60785c7..5964e8e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
/composer.lock
/phpunit.xml
/vendor/
-.phpunit.result.cache
+/.phpunit.cache
/.idea/
/config/Migrations/schema-dump-default.lock
+/tools
diff --git a/composer.json b/composer.json
index 676cfea..5a0ec3b 100644
--- a/composer.json
+++ b/composer.json
@@ -3,12 +3,12 @@
"description": "A CakePHP plugin which allows you to authenticate using social providers like Facebook/Google/Twitter etc.",
"type": "cakephp-plugin",
"require": {
- "cakephp/cakephp": "^4.1",
- "socialconnect/auth": "^3.1"
+ "cakephp/cakephp": "^5.0",
+ "socialconnect/auth": "^3.3"
},
"require-dev": {
- "phpunit/phpunit": "^8.5.0 || ^9.5.0",
- "cakephp/cakephp-codesniffer": "^4.0"
+ "phpunit/phpunit": "^10.1",
+ "cakephp/cakephp-codesniffer": "^5.0"
},
"autoload": {
"psr-4": {
@@ -24,8 +24,9 @@
},
"license": "MIT",
"scripts": {
- "cs-check": "vendor/bin/phpcs -n -p --extensions=php --standard=vendor/cakephp/cakephp-codesniffer/CakePHP src/ tests/",
- "cs-fix": "vendor/bin/phpcbf -p --extensions=php --standard=vendor/cakephp/cakephp-codesniffer/CakePHP src/ tests/"
+ "cs-check": "phpcs --colors -p ./src ./tests",
+ "cs-fix": "phpcbf --colors -p ./src ./tests",
+ "test": "phpunit"
},
"config": {
"allow-plugins": {
diff --git a/phpcs.xml b/phpcs.xml
new file mode 100644
index 0000000..210a0c8
--- /dev/null
+++ b/phpcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon
new file mode 100644
index 0000000..2ff2133
--- /dev/null
+++ b/phpstan-baseline.neon
@@ -0,0 +1,11 @@
+parameters:
+ ignoreErrors:
+ -
+ message: "#^Parameter \\#1 \\$callback of function call_user_func expects callable\\(\\)\\: mixed, array\\{Cake\\\\ORM\\\\Table, mixed\\} given\\.$#"
+ count: 1
+ path: src/Middleware/SocialAuthMiddleware.php
+
+ -
+ message: "#^Method ADmad\\\\SocialAuth\\\\SocialAuthPlugin\\:\\:bootstrap\\(\\) has parameter \\$app with generic interface Cake\\\\Core\\\\PluginApplicationInterface but does not specify its types\\: TSubject$#"
+ count: 1
+ path: src/SocialAuthPlugin.php
diff --git a/phpstan.neon b/phpstan.neon
index 19914e0..8cdbddf 100644
--- a/phpstan.neon
+++ b/phpstan.neon
@@ -1,3 +1,6 @@
+includes:
+ - phpstan-baseline.neon
+
parameters:
level: 8
checkMissingIterableValueType: false
@@ -5,8 +8,3 @@ parameters:
- tests/bootstrap.php
paths:
- src/
- ignoreErrors:
- -
- message: "#^Parameter \\#1 \\$function of function call_user_func expects callable\\(\\)\\: mixed, array\\{Cake\\\\ORM\\\\Table, mixed\\} given\\.$#"
- count: 1
- path: src/Middleware/SocialAuthMiddleware.php
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index 4974a28..d2bb38c 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -1,9 +1,10 @@
-
+
@@ -11,19 +12,24 @@
-
-
-
-
-
-
-
-
+
+
+
-
-
+
-
+
+
+
+
+
+
+
+
+
diff --git a/psalm.xml b/psalm.xml
index 5359f52..b538299 100644
--- a/psalm.xml
+++ b/psalm.xml
@@ -1,5 +1,8 @@
+ */
class SocialAuthMiddleware implements MiddlewareInterface, EventDispatcherInterface
{
+ /**
+ * @use \Cake\Event\EventDispatcherTrait<\ADmad\SocialAuth\Middleware\SocialAuthMiddleware>
+ */
use EventDispatcherTrait;
use InstanceConfigTrait;
use LocatorAwareTrait;
@@ -125,9 +133,9 @@ class SocialAuthMiddleware implements MiddlewareInterface, EventDispatcherInterf
* If none provided one will be auto created. Default `null`.
* - `logErrors`: Whether social connect errors should be logged. Default `true`.
*
- * @var array
+ * @var array
*/
- protected $_defaultConfig = [
+ protected array $_defaultConfig = [
'requestMethod' => 'POST',
'loginUrl' => '/users/login',
'loginRedirect' => '/',
@@ -150,40 +158,40 @@ class SocialAuthMiddleware implements MiddlewareInterface, EventDispatcherInterf
*
* @var \SocialConnect\Auth\Service|null
*/
- protected $_service;
+ protected ?Service $_service = null;
/**
* Session for SocialConnect service.
*
* @var \SocialConnect\Provider\Session\SessionInterface|null
*/
- protected $_session;
+ protected ?SessionInterface $_session;
/**
* User model instance.
*
* @var \Cake\ORM\Table
*/
- protected $_userModel;
+ protected Table $_userModel;
/**
* Profile model instance.
*
* @var \Cake\ORM\Table
*/
- protected $_profileModel;
+ protected Table $_profileModel;
/**
* Error.
*
* @var string
*/
- protected $_error;
+ protected string $_error = '';
/**
* Constructor.
*
- * @param array $config Configuration.
+ * @param array $config Configuration.
* @param \Cake\Event\EventManager|null $eventManager Event manager instance.
* @param \SocialConnect\Provider\Session\SessionInterface|null $session Session handler for SocialConnect Service
*/
@@ -322,7 +330,7 @@ protected function _setupModelInstances(): void
* @param \Cake\Http\ServerRequest $request Request instance.
* @return \Cake\Datasource\EntityInterface|null
*/
- protected function _getProfile($providerName, ServerRequest $request): ?EntityInterface
+ protected function _getProfile(string $providerName, ServerRequest $request): ?EntityInterface
{
$return = $this->_getSocialIdentity($providerName, $request);
if ($return === null) {
@@ -352,7 +360,7 @@ protected function _getProfile($providerName, ServerRequest $request): ?EntityIn
* @param \Cake\Http\ServerRequest $request Request instance.
* @return array{identity: \SocialConnect\Common\Entity\User, access_token: \SocialConnect\Provider\AccessTokenInterface}|null
*/
- protected function _getSocialIdentity($providerName, ServerRequest $request): ?array
+ protected function _getSocialIdentity(string $providerName, ServerRequest $request): ?array
{
try {
$provider = $this->_getService($request)->getProvider($providerName);
@@ -444,11 +452,11 @@ protected function _getUser(EntityInterface $profile, CakeSession $session): ?En
* @param string $providerName Provider name.
* @param \SocialConnect\Common\Entity\User $identity Social connect entity.
* @param \SocialConnect\Provider\AccessTokenInterface $accessToken Access token
- * @param \Cake\Datasource\EntityInterface $profile Social profile entity
+ * @param \Cake\Datasource\EntityInterface|null $profile Social profile entity
* @return \Cake\Datasource\EntityInterface
*/
protected function _patchProfile(
- $providerName,
+ string $providerName,
SocialConnectUser $identity,
AccessTokenInterface $accessToken,
?EntityInterface $profile = null
@@ -560,7 +568,6 @@ protected function _getService(ServerRequest $request): Service
$serviceConfig = Configure::consume('SocialAuth');
}
- /** @psalm-suppress PossiblyInvalidArrayOffset */
if (!isset($serviceConfig['redirectUri'])) {
$serviceConfig['redirectUri'] = Router::url([
'plugin' => 'ADmad/SocialAuth',
@@ -578,7 +585,6 @@ protected function _getService(ServerRequest $request): Service
new StreamFactory()
);
- /** @psalm-suppress PossiblyNullArgument */
$this->_service = new Service(
$httpStack,
$this->_session ?: new SocialConnectSession(),
@@ -603,8 +609,8 @@ protected function _setRedirectUrl(ServerRequest $request): void
$redirectUrl = $request->getQuery(static::QUERY_STRING_REDIRECT);
if (
empty($redirectUrl)
- || substr($redirectUrl, 0, 1) !== '/'
- || substr($redirectUrl, 0, 2) === '//'
+ || !str_starts_with($redirectUrl, '/')
+ || str_starts_with($redirectUrl, '//')
) {
return;
}
@@ -616,9 +622,9 @@ protected function _setRedirectUrl(ServerRequest $request): void
* Get URL to redirect to after authentication.
*
* @param \Cake\Http\ServerRequest $request Request instance.
- * @return string|array
+ * @return array|string
*/
- protected function _getRedirectUrl(ServerRequest $request)
+ protected function _getRedirectUrl(ServerRequest $request): array|string
{
$redirectUrl = $request->getSession()->read('SocialAuth.redirectUrl');
if ($redirectUrl) {
@@ -634,15 +640,15 @@ protected function _getRedirectUrl(ServerRequest $request)
* Trigger "beforeRedirect" event.
*
* @param \Psr\Http\Message\ServerRequestInterface $request Request instance.
- * @param string|array $redirectUrl Redirect URL.
+ * @param array|string $redirectUrl Redirect URL.
* @param string $status Auth status.
- * @return string|array
+ * @return array|string
*/
protected function _triggerBeforeRedirect(
- $request,
- $redirectUrl,
+ ServerRequestInterface $request,
+ array|string $redirectUrl,
string $status = self::AUTH_STATUS_SUCCESS
- ) {
+ ): array|string {
$event = $this->dispatchEvent(self::EVENT_BEFORE_REDIRECT, [
'redirectUrl' => $redirectUrl,
'status' => $status,
@@ -664,7 +670,7 @@ protected function _triggerBeforeRedirect(
* @param \Exception $exception The exception to log a message for.
* @return string Error message
*/
- protected function _getLogMessage($request, $exception): string
+ protected function _getLogMessage(ServerRequestInterface $request, Exception $exception): string
{
$message = sprintf(
'[%s] %s',
diff --git a/src/Model/Entity/SocialProfile.php b/src/Model/Entity/SocialProfile.php
index 6a55cee..7549feb 100644
--- a/src/Model/Entity/SocialProfile.php
+++ b/src/Model/Entity/SocialProfile.php
@@ -23,19 +23,19 @@
* @property string|null $last_name
* @property string|null $full_name
* @property string|null $email
- * @property \Cake\I18n\FrozenDate|null $birth_date
+ * @property \Cake\I18n\Date|null $birth_date
* @property string|null $gender
* @property string|null $picture_url
* @property bool $email_verified
- * @property \Cake\I18n\FrozenTime|null $created
- * @property \Cake\I18n\FrozenTime|null $modified
+ * @property \Cake\I18n\Time|null $created
+ * @property \Cake\I18n\Time|null $modified
*/
class SocialProfile extends Entity
{
/**
* @var array
*/
- protected $_accessible = [
+ protected array $_accessible = [
'*' => true,
'id' => false,
];
diff --git a/src/Model/Table/SocialProfilesTable.php b/src/Model/Table/SocialProfilesTable.php
index 171d149..6f7b028 100644
--- a/src/Model/Table/SocialProfilesTable.php
+++ b/src/Model/Table/SocialProfilesTable.php
@@ -10,23 +10,22 @@
namespace ADmad\SocialAuth\Model\Table;
-use Cake\Database\Schema\TableSchemaInterface;
use Cake\ORM\Table;
/**
* @method \ADmad\SocialAuth\Model\Entity\SocialProfile newEmptyEntity()
* @method \ADmad\SocialAuth\Model\Entity\SocialProfile newEntity(array $data, array $options = [])
* @method \ADmad\SocialAuth\Model\Entity\SocialProfile[] newEntities(array $data, array $options = [])
- * @method \ADmad\SocialAuth\Model\Entity\SocialProfile get($primaryKey, $options = [])
+ * @method \ADmad\SocialAuth\Model\Entity\SocialProfile get(mixed $primaryKey, array|string $finder = 'all', \Psr\SimpleCache\CacheInterface|string|null $cache = null, \Closure|string|null $cacheKey = null, mixed ...$args)
* @method \ADmad\SocialAuth\Model\Entity\SocialProfile findOrCreate($search, ?callable $callback = null, $options = [])
* @method \ADmad\SocialAuth\Model\Entity\SocialProfile patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
* @method \ADmad\SocialAuth\Model\Entity\SocialProfile[] patchEntities(iterable $entities, array $data, array $options = [])
* @method \ADmad\SocialAuth\Model\Entity\SocialProfile|false save(\Cake\Datasource\EntityInterface $entity, $options = [])
* @method \ADmad\SocialAuth\Model\Entity\SocialProfile saveOrFail(\Cake\Datasource\EntityInterface $entity, $options = [])
- * @method \ADmad\SocialAuth\Model\Entity\SocialProfile[]|\Cake\Datasource\ResultSetInterface|false saveMany(iterable $entities, $options = [])
- * @method \ADmad\SocialAuth\Model\Entity\SocialProfile[]|\Cake\Datasource\ResultSetInterface saveManyOrFail(iterable $entities, $options = [])
- * @method \ADmad\SocialAuth\Model\Entity\SocialProfile[]|\Cake\Datasource\ResultSetInterface|false deleteMany(iterable $entities, $options = [])
- * @method \ADmad\SocialAuth\Model\Entity\SocialProfile[]|\Cake\Datasource\ResultSetInterface deleteManyOrFail(iterable $entities, $options = [])
+ * @method \ADmad\SocialAuth\Model\Entity\SocialProfile[]|false saveMany(iterable $entities, $options = [])
+ * @method \ADmad\SocialAuth\Model\Entity\SocialProfile[] saveManyOrFail(iterable $entities, $options = [])
+ * @method \ADmad\SocialAuth\Model\Entity\SocialProfile[]|false deleteMany(iterable $entities, $options = [])
+ * @method \ADmad\SocialAuth\Model\Entity\SocialProfile[] deleteManyOrFail(iterable $entities, $options = [])
* @mixin \Cake\ORM\Behavior\TimestampBehavior
*/
class SocialProfilesTable extends Table
@@ -34,7 +33,7 @@ class SocialProfilesTable extends Table
/**
* Initialize table.
*
- * @param array $config Configuration
+ * @param array $config Configuration
* @return void
*/
public function initialize(array $config): void
@@ -42,18 +41,6 @@ public function initialize(array $config): void
parent::initialize($config);
$this->addBehavior('Timestamp');
- }
-
- /**
- * Set custom type of "access_token" column.
- *
- * @param \Cake\Database\Schema\TableSchemaInterface $schema The table definition fetched from database.
- * @return \Cake\Database\Schema\TableSchemaInterface
- */
- protected function _initializeSchema(TableSchemaInterface $schema): TableSchemaInterface
- {
- $schema->setColumnType('access_token', 'social-auth.serialized');
-
- return $schema;
+ $this->getSchema()->setColumnType('access_token', 'social-auth.serialized');
}
}
diff --git a/src/Plugin.php b/src/SocialAuthPlugin.php
similarity index 89%
rename from src/Plugin.php
rename to src/SocialAuthPlugin.php
index bed64a1..989b543 100644
--- a/src/Plugin.php
+++ b/src/SocialAuthPlugin.php
@@ -16,12 +16,14 @@
use Cake\Database\TypeFactory;
use Cake\Routing\RouteBuilder;
-class Plugin extends BasePlugin
+class SocialAuthPlugin extends BasePlugin
{
+ protected ?string $name = 'SocialAuth';
+
/**
* @var bool
*/
- protected $consoleEnabled = false;
+ protected bool $consoleEnabled = false;
/**
* @param \Cake\Core\PluginApplicationInterface $app Application instance.
@@ -41,7 +43,7 @@ public function routes(RouteBuilder $routes): void
$routes->scope(
'/social-auth',
['plugin' => 'ADmad/SocialAuth', 'controller' => 'Auth'],
- function (RouteBuilder $routes) {
+ function (RouteBuilder $routes): void {
$routes->connect(
'/login/{provider}',
['action' => 'login'],
diff --git a/tests/Fixture/SocialProfilesFixture.php b/tests/Fixture/SocialProfilesFixture.php
deleted file mode 100644
index 24a422e..0000000
--- a/tests/Fixture/SocialProfilesFixture.php
+++ /dev/null
@@ -1,56 +0,0 @@
- ['type' => 'integer', 'length' => null, 'unsigned' => false, 'null' => false, 'default' => null, 'autoIncrement' => true],
- 'user_id' => ['type' => 'integer', 'length' => null, 'unsigned' => false, 'null' => true, 'default' => null, 'autoIncrement' => null],
- 'provider' => ['type' => 'string', 'length' => 255, 'null' => false, 'default' => null],
- 'access_token' => ['type' => 'binary', 'length' => null, 'null' => false, 'default' => null],
- 'identifier' => ['type' => 'string', 'length' => 255, 'null' => false, 'default' => null],
- 'username' => ['type' => 'string', 'length' => 255, 'null' => true, 'default' => null],
- 'first_name' => ['type' => 'string', 'length' => 255, 'null' => true, 'default' => null],
- 'last_name' => ['type' => 'string', 'length' => 255, 'null' => true, 'default' => null],
- 'full_name' => ['type' => 'string', 'length' => 255, 'null' => true, 'default' => null],
- 'email' => ['type' => 'string', 'length' => 255, 'null' => true, 'default' => null],
- 'birth_date' => ['type' => 'date', 'length' => null, 'null' => true, 'default' => null],
- 'gender' => ['type' => 'string', 'length' => 255, 'null' => true, 'default' => null],
- 'picture_url' => ['type' => 'string', 'length' => 255, 'null' => true, 'default' => null],
- 'email_verified' => ['type' => 'boolean', 'length' => null, 'null' => false, 'default' => '0'],
- 'created' => ['type' => 'datetime', 'length' => null, 'null' => true, 'default' => null],
- 'modified' => ['type' => 'datetime', 'length' => null, 'null' => true, 'default' => null],
- '_indexes' => [
- 'user_id' => ['type' => 'index', 'columns' => ['user_id'], 'length' => []],
- ],
- '_constraints' => [
- 'primary' => ['type' => 'primary', 'columns' => ['id'], 'length' => []],
- ],
- ];
- // phpcs:enable
-
- /**
- * Init method
- *
- * @return void
- */
- public function init(): void
- {
- $this->records = [];
-
- parent::init();
- }
-}
diff --git a/tests/Fixture/UsersFixture.php b/tests/Fixture/UsersFixture.php
deleted file mode 100644
index 647e7d4..0000000
--- a/tests/Fixture/UsersFixture.php
+++ /dev/null
@@ -1,39 +0,0 @@
- ['type' => 'integer', 'length' => null, 'unsigned' => false, 'null' => false, 'default' => null, 'autoIncrement' => true],
- 'email' => ['type' => 'string', 'length' => 255, 'null' => true, 'default' => null],
- '_constraints' => [
- 'primary' => ['type' => 'primary', 'columns' => ['id'], 'length' => []],
- ],
- ];
- // phpcs:enable
-
- /**
- * Init method
- *
- * @return void
- */
- public function init(): void
- {
- $this->records = [];
-
- parent::init();
- }
-}
diff --git a/tests/TestCase/Middleware/SocialAuthMiddlewareTest.php b/tests/TestCase/Middleware/SocialAuthMiddlewareTest.php
index b336a6f..eebdf34 100644
--- a/tests/TestCase/Middleware/SocialAuthMiddlewareTest.php
+++ b/tests/TestCase/Middleware/SocialAuthMiddlewareTest.php
@@ -10,23 +10,20 @@
use Cake\Event\EventManager;
use Cake\Http\Exception\MethodNotAllowedException;
use Cake\Http\Response;
+use Cake\Http\ServerRequest;
use Cake\Http\ServerRequestFactory;
use Cake\TestSuite\TestCase;
+use Psr\Http\Server\RequestHandlerInterface;
use SocialConnect\Common\Entity\User;
use SocialConnect\Provider\AccessTokenInterface;
use SocialConnect\Provider\Session\Dummy;
use TestApp\Http\TestRequestHandler;
-/**
- * @property \Cake\Http\ServerRequest $request
- * @property \Psr\Http\Server\RequestHandlerInterface $handler
- */
class SocialAuthMiddlewareTest extends TestCase
{
- protected $fixtures = [
- 'plugin.ADmad/SocialAuth.Users',
- 'plugin.ADmad/SocialAuth.SocialProfiles',
- ];
+ protected ServerRequest $request;
+
+ protected RequestHandlerInterface $handler;
public function setUp(): void
{
diff --git a/tests/TestCase/Model/Table/SocialProfilesTableTest.php b/tests/TestCase/Model/Table/SocialProfilesTableTest.php
index cf002fd..30d2624 100644
--- a/tests/TestCase/Model/Table/SocialProfilesTableTest.php
+++ b/tests/TestCase/Model/Table/SocialProfilesTableTest.php
@@ -3,19 +3,12 @@
namespace ADmad\SocialAuth\Test\TestCase\Model\Table;
+use ADmad\SocialAuth\Model\Table\SocialProfilesTable;
use Cake\TestSuite\TestCase;
-/**
- * @property \ADmad\SocialAuth\Model\Table\SocialProfilesTable $socialProfilesTable
- */
class SocialProfilesTableTest extends TestCase
{
- /**
- * @var string[]
- */
- protected $fixtures = [
- 'plugin.ADmad/SocialAuth.SocialProfiles',
- ];
+ protected SocialProfilesTable $socialProfilesTable;
/**
* @return void
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
index 1f6835f..9f7192c 100644
--- a/tests/bootstrap.php
+++ b/tests/bootstrap.php
@@ -1,8 +1,6 @@
'social_profiles',
+ 'columns' => [
+ 'id' => ['type' => 'integer', 'length' => null, 'unsigned' => false, 'null' => false, 'default' => null, 'autoIncrement' => true],
+ 'user_id' => ['type' => 'integer', 'length' => null, 'unsigned' => false, 'null' => true, 'default' => null, 'autoIncrement' => null],
+ 'provider' => ['type' => 'string', 'length' => 255, 'null' => false, 'default' => null],
+ 'access_token' => ['type' => 'binary', 'length' => null, 'null' => false, 'default' => null],
+ 'identifier' => ['type' => 'string', 'length' => 255, 'null' => false, 'default' => null],
+ 'username' => ['type' => 'string', 'length' => 255, 'null' => true, 'default' => null],
+ 'first_name' => ['type' => 'string', 'length' => 255, 'null' => true, 'default' => null],
+ 'last_name' => ['type' => 'string', 'length' => 255, 'null' => true, 'default' => null],
+ 'full_name' => ['type' => 'string', 'length' => 255, 'null' => true, 'default' => null],
+ 'email' => ['type' => 'string', 'length' => 255, 'null' => true, 'default' => null],
+ 'birth_date' => ['type' => 'date', 'length' => null, 'null' => true, 'default' => null],
+ 'gender' => ['type' => 'string', 'length' => 255, 'null' => true, 'default' => null],
+ 'picture_url' => ['type' => 'string', 'length' => 255, 'null' => true, 'default' => null],
+ 'email_verified' => ['type' => 'boolean', 'length' => null, 'null' => false, 'default' => '0'],
+ 'created' => ['type' => 'datetime', 'length' => null, 'null' => true, 'default' => null],
+ 'modified' => ['type' => 'datetime', 'length' => null, 'null' => true, 'default' => null],
+ ],
+ 'constraints' => [
+ 'primary' => ['type' => 'primary', 'columns' => ['id'], 'length' => []],
+ ],
+ ],
+ [
+ 'table' => 'users',
+ 'columns' => [
+ 'id' => ['type' => 'integer', 'length' => null, 'unsigned' => false, 'null' => false, 'default' => null, 'autoIncrement' => true],
+ 'email' => ['type' => 'string', 'length' => 255, 'null' => true, 'default' => null],
+ ],
+ 'constraints' => [
+ 'primary' => ['type' => 'primary', 'columns' => ['id'], 'length' => []],
+ ],
+ ],
+];
diff --git a/tests/test_app/src/Http/TestRequestHandler.php b/tests/test_app/src/Http/TestRequestHandler.php
index cef398f..77ada6e 100644
--- a/tests/test_app/src/Http/TestRequestHandler.php
+++ b/tests/test_app/src/Http/TestRequestHandler.php
@@ -12,7 +12,7 @@ class TestRequestHandler implements RequestHandlerInterface
{
public $callable;
- public $called = false;
+ public bool $called = false;
public function __construct(?callable $callable = null)
{