Skip to content

fangx-packages/hyperf-sqlite-driver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hyperf-sqlite-driver

在 hyperf 中使用 sqlite 作为数据驱动.

SQLite 不支持协程, 请不要在生产中使用, 本扩展的初衷是使用 SQLite 作为驱动来进行单元测试.

安装

composer require fangx/sqlite-driver --dev

使用

使用前需配置好相关数据回滚迁移等配置, 推荐使用 fangx/testing

修改 phpunit.xml 中的数据库配置

<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
         backupStaticAttributes="false"
         bootstrap="./test/bootstrap.php"
         colors="true"
         convertErrorsToExceptions="true"
         convertNoticesToExceptions="true"
         convertWarningsToExceptions="true"
         processIsolation="false"
         stopOnFailure="false">
    <testsuites>
        <testsuite name="Tests">
            <directory suffix="Test.php">./test</directory>
        </testsuite>
    </testsuites>
    <filter>
        <whitelist processUncoveredFilesFromWhitelist="true">
            <directory suffix=".php">./app</directory>
        </whitelist>
    </filter>
    <php>
        <env name="DB_DRIVER" value="sqlite"/>
        <env name="DB_DATABASE" value=":memory:"/>
    </php>
</phpunit>

运行测试

composer test

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages