Skip to content

Commit

Permalink
Merge pull request #1 from datamweb/chore-fix
Browse files Browse the repository at this point in the history
Chore fix
  • Loading branch information
datamweb authored Nov 14, 2023
2 parents 508b1cb + f726bd4 commit 9436c93
Show file tree
Hide file tree
Showing 9 changed files with 168 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@ jobs:
- name: Analyze for refactoring
run: |
composer global require --dev rector/rector:^0.15.1
composer global require --dev rector/rector:^0.18.7
rector process --dry-run --no-progress-bar
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
[Farsi](./README.fa-IR.md) | English
## CodeIgniter DEA Rule
[![PHPUnit](https://github.com/datamweb/codeigniter-dea-rule/actions/workflows/phpunit.yml/badge.svg)](https://github.com/datamweb/codeigniter-dea-rule/actions/workflows/phpunit.yml)
[![Coverage Status](https://coveralls.io/repos/github/datamweb/codeigniter-dea-rule/badge.svg?branch=develop)](https://coveralls.io/github/datamweb/codeigniter-dea-rule?branch=develop)
[![PHPStan](https://github.com/datamweb/codeigniter-dea-rule/actions/workflows/phpstan.yml/badge.svg)](https://github.com/datamweb/codeigniter-dea-rule/actions/workflows/phpstan.yml)
[![Rector](https://github.com/datamweb/codeigniter-dea-rule/actions/workflows/rector.yml/badge.svg)](https://github.com/datamweb/codeigniter-dea-rule/actions/workflows/rector.yml)
[![Psalm](https://github.com/datamweb/codeigniter-dea-rule/actions/workflows/psalm.yml/badge.svg)](https://github.com/datamweb/codeigniter-dea-rule/actions/workflows/psalm.yml)
[![PHPCSFixer](https://github.com/datamweb/codeigniter-dea-ruleactions/workflows/phpcsfixer.yml/badge.svg)](https://github.com/datamweb/codeigniter-dea-ruleactions/workflows/phpcsfixer.yml)
[![PHPCPD](https://github.com/datamweb/codeigniter-dea-ruleactions/workflows/phpcpd.yml/badge.svg)](https://github.com/datamweb/codeigniter-dea-ruleactions/workflows/phpcpd.yml)
[![PHPCSFixer](https://github.com/datamweb/codeigniter-dea-rule/actions/workflows/phpcsfixer.yml/badge.svg)](https://github.com/datamweb/codeigniter-dea-rule/actions/workflows/phpcsfixer.yml)
[![PHPCPD](https://github.com/datamweb/codeigniter-dea-rule/actions/workflows/phpcpd.yml/badge.svg)](https://github.com/datamweb/codeigniter-dea-rule/actions/workflows/phpcpd.yml)
[![Unused](https://github.com/datamweb/codeigniter-dea-rule/actions/workflows/unused.yml/badge.svg)](https://github.com/datamweb/codeigniter-dea-rule/actions/workflows/unused.yml)
[![Deptrac](https://github.com/datamweb/codeigniter-dea-rule/actions/workflows/deptrac.yml/badge.svg)](https://github.com/datamweb/codeigniter-dea-rule/actions/workflows/deptrac.yml)


<p align="center"><img src="https://github.com/datamweb/my-repository-files/blob/main/codeigniter-dea-rule/image/logo.png" alt="CodeIgniter DEA Rule"></p>

[![Latest Stable Version](http://poser.pugx.org/datamweb/codeigniter-dea-rulev?style=for-the-badge)](https://packagist.org/packages/datamweb/shield-oauth) [![Total Downloads](http://poser.pugx.org/datamweb/codeigniter-dea-ruledownloads?style=for-the-badge)](https://packagist.org/packages/datamweb/shield-oauth) [![Latest Unstable Version](http://poser.pugx.org/datamweb/codeigniter-dea-rulev/unstable?style=for-the-badge)](https://packagist.org/packages/datamweb/shield-oauth) [![License](http://poser.pugx.org/datamweb/codeigniter-dea-rulelicense?style=for-the-badge)](https://packagist.org/packages/datamweb/shield-oauth) [![PHP Version Require](http://poser.pugx.org/datamweb/codeigniter-dea-rulerequire/php?style=for-the-badge)](https://packagist.org/packages/datamweb/shield-oauth)
[![Latest Stable Version](http://poser.pugx.org/datamweb/codeigniter-dea-rule/v?style=for-the-badge)](https://packagist.org/packages/datamweb/codeigniter-dea-rule) [![Total Downloads](http://poser.pugx.org/datamweb/codeigniter-dea-rule/downloads?style=for-the-badge)](https://packagist.org/packages/datamweb/codeigniter-dea-rule) [![Latest Unstable Version](http://poser.pugx.org/datamweb/codeigniter-dea-rule/v/unstable?style=for-the-badge)](https://packagist.org/packages/datamweb/codeigniter-dea-rule) [![License](http://poser.pugx.org/datamweb/codeigniter-dea-rule/license?style=for-the-badge)](https://packagist.org/packages/datamweb/codeigniter-dea-rule) [![PHP Version Require](http://poser.pugx.org/datamweb/codeigniter-dea-rule/require/php?style=for-the-badge)](https://packagist.org/packages/datamweb/codeigniter-dea-rule)


**`CodeIgniter DEA Rule`** helps you to validate the email provided by the user and to deal with it if the email was of Temporary & Disponsable Emails(DEA) use type.
Expand Down
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## CodeIgniter DEA Rule
[![PHPUnit](https://github.com/datamweb/codeigniter-dea-rule/actions/workflows/phpunit.yml/badge.svg)](https://github.com/datamweb/codeigniter-dea-rule/actions/workflows/phpunit.yml)
[![Coverage Status](https://coveralls.io/repos/github/datamweb/codeigniter-dea-rule/badge.svg?branch=develop)](https://coveralls.io/github/datamweb/codeigniter-dea-rule?branch=develop)
[![PHPStan](https://github.com/datamweb/codeigniter-dea-rule/actions/workflows/phpstan.yml/badge.svg)](https://github.com/datamweb/codeigniter-dea-rule/actions/workflows/phpstan.yml)
[![Rector](https://github.com/datamweb/codeigniter-dea-rule/actions/workflows/rector.yml/badge.svg)](https://github.com/datamweb/codeigniter-dea-rule/actions/workflows/rector.yml)
[![Psalm](https://github.com/datamweb/codeigniter-dea-rule/actions/workflows/psalm.yml/badge.svg)](https://github.com/datamweb/codeigniter-dea-rule/actions/workflows/psalm.yml)
Expand Down
15 changes: 10 additions & 5 deletions phpstan-baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@

$ignoreErrors = [];

// $ignoreErrors[] = [
// 'message' => '#^Property Datamweb\\\\CodeIgniterDEARule\\\\Database\\\\Migrations\\\\LogsTempEmailMigration\\:\\:\\$attributes type has no value type specified in iterable type array\\.$#',
// 'count' => 1,
// 'path' => __DIR__ . '/src/Database/Migrations/2023-11-11-105553_LogsTempEmailMigration.php',
// ];
$ignoreErrors[] = [
'message' => '#^Property Tests\\\\Support\\\\Config\\\\Registrar\\:\\:\\$dbConfig type has no value type specified in iterable type array\\.$#',
'count' => 1,
'path' => __DIR__ . '/tests/_support/Config/Registrar.php',
];
$ignoreErrors[] = [
'message' => '#^Method Tests\\\\Support\\\\Config\\\\Registrar\\:\\:Database\\(\\) return type has no value type specified in iterable type array\\.$#',
'count' => 1,
'path' => __DIR__ . '/tests/_support/Config/Registrar.php',
];
return ['parameters' => ['ignoreErrors' => $ignoreErrors]];
6 changes: 3 additions & 3 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,13 @@
<!-- Database configuration -->
<env name="database.tests.strictOn" value="true"/>
<!-- Uncomment to use alternate testing database configuration -->
<env name="database.tests.hostname" value="localhost"/>
<!-- <env name="database.tests.hostname" value="localhost"/>
<env name="database.tests.database" value="shieldb6tob7"/>
<env name="database.tests.username" value="root"/>
<env name="database.tests.password" value=""/>
<env name="database.tests.DBDriver" value="MySQLi"/>
<env name="database.tests.DBDriver" value="MySQLi"/> -->

<env name="database.tests.DBPrefix" value=""/>
<!-- <env name="database.tests.DBPrefix" value=""/> -->

</php>
</phpunit>
1 change: 1 addition & 0 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
TypedPropertyFromAssignsRector::class => [
__DIR__ . '/src/Models/LogsTempEmailModel.php',
__DIR__ . '/src/Commands/DEARulePublish.php',
__DIR__ . '/tests/_support/Config/Registrar.php',
],
]);

Expand Down
2 changes: 1 addition & 1 deletion src/Commands/DEARulePublish.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
declare(strict_types=1);

/**
* This file is part of CodeIgniter4 GO TO PAY.
* This file is part of CodeIgniter-DEA-Rule.
*
* (c) 2023 Datamweb <pooya_parsa_dadashi@yahoo.com>
*
Expand Down
4 changes: 2 additions & 2 deletions src/Config/DEARule.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ class DEARule
*/
public array $filesBlacklisted = [
'https://raw.githubusercontent.com/wesbos/burner-email-providers/master/emails.txt',
//'https://raw.githubusercontent.com/disposable-email-domains/disposable-email-domains/master/disposable_email_blocklist.conf',
//'https://gist.githubusercontent.com/saaiful/dd2b4b34a02171d7f9f0b979afe48f65/raw/2ad5590be72b69a51326b3e9d229f615e866f2e5/blocklist.txt',
// 'https://raw.githubusercontent.com/disposable-email-domains/disposable-email-domains/master/disposable_email_blocklist.conf',
// 'https://gist.githubusercontent.com/saaiful/dd2b4b34a02171d7f9f0b979afe48f65/raw/2ad5590be72b69a51326b3e9d229f615e866f2e5/blocklist.txt',

// APPPATH . 'myCustomDomainBlacklisted.txt',
];
Expand Down
145 changes: 145 additions & 0 deletions tests/_support/Config/Registrar.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
<?php

declare(strict_types=1);

/**
* This file is part of CodeIgniter-DEA-Rule.
*
* (c) 2023 Datamweb <pooya_parsa_dadashi@yahoo.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/

namespace Tests\Support\Config;

/**
* Class Registrar
*
* Provides a basic registrar class for testing BaseConfig registration functions.
*/
class Registrar
{
/**
* DB config array for testing purposes.
*
* @var array
*
* @psalm-suppress RedundantCondition
*/
protected static $dbConfig = [
'MySQLi' => [
'DSN' => '',
'hostname' => '127.0.0.1',
'username' => 'root',
'password' => '',
'database' => 'test',
'DBDriver' => 'MySQLi',
'DBPrefix' => 'db_',
'pConnect' => false,
'DBDebug' => true,
'charset' => 'utf8',
'DBCollat' => 'utf8_general_ci',
'swapPre' => '',
'encrypt' => false,
'compress' => false,
'strictOn' => false,
'failover' => [],
'port' => 3306,
],
'Postgre' => [
'DSN' => '',
'hostname' => 'localhost',
'username' => 'postgres',
'password' => 'postgres',
'database' => 'test',
'DBDriver' => 'Postgre',
'DBPrefix' => 'db_',
'pConnect' => false,
'DBDebug' => true,
'charset' => 'utf8',
'DBCollat' => 'utf8_general_ci',
'swapPre' => '',
'encrypt' => false,
'compress' => false,
'strictOn' => false,
'failover' => [],
'port' => 5432,
],
'SQLite3' => [
'DSN' => '',
'hostname' => 'localhost',
'username' => '',
'password' => '',
'database' => 'database.db',
'DBDriver' => 'SQLite3',
'DBPrefix' => 'db_',
'pConnect' => false,
'DBDebug' => true,
'charset' => 'utf8',
'DBCollat' => 'utf8_general_ci',
'swapPre' => '',
'encrypt' => false,
'compress' => false,
'strictOn' => false,
'failover' => [],
'port' => 3306,
'foreignKeys' => true,
],
'SQLSRV' => [
'DSN' => '',
'hostname' => 'localhost',
'username' => 'sa',
'password' => '1Secure*Password1',
'database' => 'test',
'DBDriver' => 'SQLSRV',
'DBPrefix' => 'db_',
'pConnect' => false,
'DBDebug' => true,
'charset' => 'utf8',
'DBCollat' => 'utf8_general_ci',
'swapPre' => '',
'encrypt' => false,
'compress' => false,
'strictOn' => false,
'failover' => [],
'port' => 1433,
],
'OCI8' => [
'DSN' => 'localhost:1521/XEPDB1',
'hostname' => '',
'username' => 'ORACLE',
'password' => 'ORACLE',
'database' => '',
'DBDriver' => 'OCI8',
'DBPrefix' => 'db_',
'pConnect' => false,
'DBDebug' => true,
'charset' => 'utf8',
'DBCollat' => 'utf8_general_ci',
'swapPre' => '',
'encrypt' => false,
'compress' => false,
'strictOn' => false,
'failover' => [],
],
];

/**
* Override database config
*
* @return array
*/
public static function Database()
{
$config = [];

// Under GitHub Actions, we can set an ENV var named 'DB'
// so that we can test against multiple databases.
if (($group = getenv('DB')) && ! isset(self::$dbConfig[$group])) {
$config['tests'] = self::$dbConfig[$group];
}

return $config;
}
}

0 comments on commit 9436c93

Please sign in to comment.