Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: easyswoole-permission
MYSQL_DATABASE: easyswoole_permission
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
Expand Down Expand Up @@ -60,6 +60,23 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

- name: create casbin_rules table
run: |
sudo apt-get install -y mysql-client
mysql --host 127.0.0.1 --port 3306 -u root -p -e "USE easyswoole_permission; CREATE TABLE if not exists casbin_rules (
id BigInt(20) unsigned NOT NULL AUTO_INCREMENT,
ptype varchar(255) DEFAULT NULL,
v0 varchar(255) DEFAULT NULL,
v1 varchar(255) DEFAULT NULL,
v2 varchar(255) DEFAULT NULL,
v3 varchar(255) DEFAULT NULL,
v4 varchar(255) DEFAULT NULL,
v5 varchar(255) DEFAULT NULL,
create_time timestamp NULL DEFAULT NULL,
update_time timestamp NULL DEFAULT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4"

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
Expand Down
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
},
"require-dev": {
"easyswoole/easyswoole": "~3.3|~3.4",
"easyswoole/ddl": "^1.0",
"easyswoole/phpunit": "^1.0"
},
"autoload": {
Expand Down
2 changes: 1 addition & 1 deletion dev.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
'port' => 3306,
'user' => 'root',
'password' => '',
'database' => 'easyswoole',
'database' => 'easyswoole_permission',
'timeout' => 5,
'charset' => 'utf8mb4',
]
Expand Down
24 changes: 1 addition & 23 deletions tests/DatabaseAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
use EasySwoole\Permission\Config;
use EasySwoole\ORM\Db\Connection;
use EasySwoole\EasySwoole\Config as ESConfig;
use EasySwoole\DDL\Blueprint\Create\Table as CreateTable;
use EasySwoole\DDL\DDLBuilder;
use EasySwoole\DDL\Enum\Character;
use EasySwoole\DDL\Enum\Engine;

class DatabaseAdapterTest extends TestCase
{
Expand All @@ -31,7 +27,6 @@ protected function getEnforcer()
$this->initConfig();
$config = new Config();
$casbin = new Casbin($config);
$this->initTable();
$this->initDb();
return $casbin->enforcer();
}
Expand All @@ -45,7 +40,7 @@ protected function initConfig()
'port' => 3306,
'user' => 'root',
'password' => '',
'database' => 'easyswoole',
'database' => 'easyswoole_permission',
'timeout' => 5,
'charset' => 'utf8mb4',
];
Expand All @@ -54,23 +49,6 @@ protected function initConfig()
DbManager::getInstance()->addConnection(new Connection($config));
}

public function initTable()
{
DDLBuilder::create('casbin_rules', function (CreateTable $table) {
$table->setIfNotExists()->setTableComment('rule table of casbin');
$table->setTableCharset(Character::UTF8MB4_GENERAL_CI);
$table->setTableEngine(Engine::MYISAM);
$table->int('id')->setIsUnsigned()->setIsAutoIncrement()->setIsPrimaryKey();
$table->varchar('ptype', 255);
$table->varchar('v0', 255);
$table->varchar('v1', 255);
$table->varchar('v2', 255);
$table->varchar('v3', 255);
$table->varchar('v4', 255);
$table->varchar('v5', 255);
});
}

public function testRemovePolicy()
{
$e = $this->getEnforcer();
Expand Down