国产xxxx99真实实拍_久久不雅视频_高清韩国a级特黄毛片_嗯老师别我我受不了了小说

資訊專欄INFORMATION COLUMN

何成為 QueryPHP 開發者

bigdevil_s / 655人閱讀

摘要:文檔開發基于單元測試實現的自動化文檔當前文檔開發計劃功能開發當前計劃功能技術債務清償當前技術債務單元測試盡可能減少當前單元測試成為開發者需要加入我們的組織,如有相關意愿請發送郵件至小牛哥,我們會聯系你的。

QueryPHP 非常歡迎各位給我們共同的偉大的作品添磚加瓦,實現為 PHP 社區提供一個好框架的美好愿景。

文檔開發.基于單元測試實現的自動化文檔 當前文檔開發

計劃功能.開發 當前計劃功能

技術債務.清償 當前技術債務

單元測試.盡可能減少 Bug 當前單元測試

成為開發者需要加入我們的組織,如有相關意愿請發送郵件至 小牛哥 <635750556@qq.com>,我們會聯系你的。

成為開發者并沒有什么任務負擔,一切主要以你的意愿,興趣才是最重要的。

本篇指南將帶你搭建的 QueryPHP 開發框架的開發環境,使得你可以參與 QueryPHP 底層代碼、單元測試和文檔等開發工作。

這里以筆者的 Mac 為例子說明,其實 Windows 下面還更簡單些。

克隆 queryphp 倉庫

QueryPHP 框架的開發來自于從克隆主倉庫開始,由于國內訪問 Github 網速的問題,只需要等待一小段時間。

下載代碼

$cd /data/codes/test
$git clone git@github.com:hunzhiwange/queryphp.git

Composer 安裝

composer install
如果你電腦沒有安裝 composer,那么已經為你下載一個版本。
sudo chmod 777 ./build/composer
./build/composer install

安裝過程

Cloning into "queryphp"...
remote: Enumerating objects: 54, done.
remote: Counting objects: 100% (54/54), done.
remote: Compressing objects: 100% (39/39), done.
remote: Total 17821 (delta 19), reused 36 (delta 14), pack-reused 17767
Receiving objects: 100% (17821/17821), 45.12 MiB | 693.00 KiB/s, done.
Resolving deltas: 100% (8700/8700), done.

測試是否安裝成功

如果可以訪問,那么恭喜你第一階段即安裝完畢。

標準后臺 API 端

首先我們需要創建一個數據庫來運行我們的后臺,讓我們對 QueryPHP 有一個直觀的感受,同時方便后期開發調試等。

首先創建一個數據庫

可以用 Navicat For Mysql 創建一個數據庫 queryphp_development_db.

CREATE DATABASE IF NOT EXISTS queryphp_development_db DEFAULT CHARSET utf8 COLLATE utf8_general_ci;

修改 .env

...
// Database
DATABASE_DRIVER = mysql
DATABASE_HOST = 127.0.0.1
DATABASE_PORT = 3306
DATABASE_NAME = queryphp_development_db
DATABASE_USER = root
DATABASE_PASSWORD =
...


修改為


...
// Database
DATABASE_DRIVER = mysql
DATABASE_HOST = 127.0.0.1
DATABASE_PORT = 3306
DATABASE_NAME = queryphp_development_db
DATABASE_USER = root
DATABASE_PASSWORD = 123456
...

執行數據庫遷移命令

php leevel migrate:migrate

安裝過程

using config file ./phinx.php
using config parser php
using migration paths
- /data/codes/test/queryphp/database/migrations
using seed paths
- /data/codes/test/queryphp/database/seeds
warning no environment specified, defaulting to: development
using adapter mysql
using database queryphp_development_db


== 20181109060739 App: migrating
== 20181109060739 App: migrated 0.0155s


== 20181112023649 Role: migrating
== 20181112023649 Role: migrated 0.0160s


== 20181112024140 User: migrating
== 20181112024140 User: migrated 0.0166s


== 20181112024211 Permission: migrating
== 20181112024211 Permission: migrated 0.0225s


== 20181112024241 UserRole: migrating
== 20181112024241 UserRole: migrated 0.0155s


== 20181112024302 RolePermission: migrating
== 20181112024302 RolePermission: migrated 0.0206s


== 20181112024416 Resource: migrating
== 20181112024416 Resource: migrated 0.0328s


== 20181112024450 PermissionResource: migrating
== 20181112024450 PermissionResource: migrated 0.0305s


== 20181203130724 Option: migrating
== 20181203130724 Option: migrated 0.0170s


== 20181203144731 Test: migrating
== 20181203144731 Test: migrated 0.0133s


All Done. Took 0.2273s

測試數據庫是否正常

php leevel server 

結果

{
    count: 4,
    :trace: {
        ...
    }
}
標準后臺前端端

后臺 API 搭建好了,我們開始搭建前端了,前端基于 Vue-cli 3IView,首先需要安裝 node 才能夠跑起來。

對于開發 QueryPHP 來說,你不需要會 Vue 或者 JavaScript,所以請放心不要有心里負擔。

安裝前端

第一步安裝前端,細節信息可以在 frontend/README.md 查看.

cd frontend
npm install -g cnpm --registry=https://registry.npm.taobao.org // Just once
cnpm install

安裝過程

? All packages installed (1264 packages installed from npm registry, used 14s(network 13s), speed 221.08kB/s, json 1086(2.23MB), tarball 501.92kB)

運行前端

接著訪問這個登陸地址.

npm run serve # npm run dev 

輸入登陸用戶名和密碼,這個時候 QueryPHP 不再是一個冰冷的代碼,而是有一個干凈的帶有基礎權限系統的后臺。

user: admin
password: 123456
運行測試用例

QueryPHP 推崇通過編寫測試用例來讓代碼變得可維護,所以這里需要本地開發跑通測試用例。

首先創建一個數據庫

可以用 Navicat For Mysql 創建一個數據庫 queryphp_development_test.

CREATE DATABASE IF NOT EXISTS queryphp_development_test DEFAULT CHARSET utf8 COLLATE utf8_general_ci;

修改 .env

...
// Database
DATABASE_DRIVER = mysql
DATABASE_HOST = 127.0.0.1
DATABASE_PORT = 3306
DATABASE_NAME = test
DATABASE_USER = root
DATABASE_PASSWORD =
...


修改為


...
// Database
DATABASE_DRIVER = mysql
DATABASE_HOST = 127.0.0.1
DATABASE_PORT = 3306
DATABASE_NAME = queryphp_development_test
DATABASE_USER = root
DATABASE_PASSWORD = 123456
...

執行數據庫遷移命令

php leevel migrate:migrate -e testing

安裝過程

using config file ./phinx.php
using config parser php
using migration paths
- /data/codes/test/queryphp/database/migrations
using seed paths
- /data/codes/test/queryphp/database/seeds
using environment testing
using adapter mysql
using database queryphp_development_test


== 20181109060739 App: migrating
== 20181109060739 App: migrated 0.0155s


== 20181112023649 Role: migrating
== 20181112023649 Role: migrated 0.0160s


== 20181112024140 User: migrating
== 20181112024140 User: migrated 0.0166s


== 20181112024211 Permission: migrating
== 20181112024211 Permission: migrated 0.0225s


== 20181112024241 UserRole: migrating
== 20181112024241 UserRole: migrated 0.0155s


== 20181112024302 RolePermission: migrating
== 20181112024302 RolePermission: migrated 0.0206s


== 20181112024416 Resource: migrating
== 20181112024416 Resource: migrated 0.0328s


== 20181112024450 PermissionResource: migrating
== 20181112024450 PermissionResource: migrated 0.0305s


== 20181203130724 Option: migrating
== 20181203130724 Option: migrated 0.0170s


== 20181203144731 Test: migrating
== 20181203144731 Test: migrated 0.0133s


All Done. Took 0.2273s

運行測試用例

php ./build/phpunit

結果

注意隨著系統演進,測試用例會增加,輸出結果就有所不同。
PHPUnit Pretty Result Printer 0.26.2 by Codedungeon and contributors.
PHPUnit 8.1.3 by Sebastian Bergmann and contributors.


==> TestsAdminServiceResourceIndexTest       ?  ?
==> TestsExampleExampleTest                    ?
==> TestsExamplePHPUnitTest                    ?
==> CommonDomainServiceSearchIndexTest       ?  ?  ?  ?  ?  ?
==> CommonInfraHelperArrayToFormTest          ?  ?  ?  ?  ?  ?
==> CommonInfraSupportWorkflowServiceTest     ?  ?  ?  ?  ?
==> CommonInfraSupportWorkflowTest            ?  ?  ?  ?  ?

Time: 391 ms, Memory: 18.00 MB

OK (26 tests, 43 assertions)
統一團隊代碼風格

風格統一對保證我們系統一致性非常重要,我們做到開箱即用,支持 PHPJavaScript

使用 Git 鉤子

cp ./build/pre-commit.sh ./.git/hooks/pre-commit
chmod 777 ./.git/hooks/pre-commit

測試自動化格式

common/Test.php


frontend/src/hello.js

function hello(a,b) {
    var c
        if(a>b) {
            c=a
        } else {
            c=b
        }
    console.log(c)
}

Git 提交測試格式化

git add .
git commit -m "測試格式化"

運行過程

Checking PHP Lint...
No syntax errors detected in common/Test.php
Running Code Sniffer...
Loaded config default from ".php_cs.dist".
Paths from configuration file have been overridden by paths provided as command arguments.
1) common/Test.php Fixed all files in 0.009 seconds, 12.000 MB memory used
The file has been automatically formatted.
[13:04:00] Working directory changed to /data/codes/test/queryphp/frontend
[13:04:00] Using gulpfile /data/codes/test/queryphp/frontend/gulpfile.js
[13:04:00] Starting "iview"...
[13:04:00] Finished "iview" after 413 μs
frontend/src/hello.js 53ms
[master 681d7e29] 測試格式化
3 files changed, 32 insertions(+)
mode change 100644 => 100755 build/composer
create mode 100644 common/Test.php
create mode 100644 frontend/src/hello.js
格式化后的 PHP

代碼干凈漂亮了不少,不是嗎。


格式化后的 JavaScript

代碼干凈漂亮了不少,不是嗎。

function hello(a, b) {
    var c
    if (a > b) {
        c = a
    } else {
        c = b
    }
    console.log(c)
}
回滾測試提交

這些測試代碼不需要提交到 Git 庫,你可以回滾掉剛才測試的這些代碼。

git log
git reset --hard 931f283b0b8847e4a3f2ad86efb3c07cd7974c3b // 或者 git revert xxx
HEAD is now at 931f283b Merge branch "dev"
克隆 framework 倉庫將框架替換為開發版本

應用層框架全部搭建完畢,接下來我們將框架層代碼替換為開發階段的代碼來進行日常框架迭代。

刪除框架層

rm -rf ./vendor/hunzhiwange/framework

克隆框架層開發庫

$cd /data/codes/test
$git clone git@github.com:hunzhiwange/framework.git ./vendor/hunzhiwange/framework
cd ./vendor/hunzhiwange/framework

Composer 安裝

composer install
如果你電腦沒有安裝 composer,那么已經為你下載一個版本。
sudo chmod 777 ./build/composer
./build/composer install

安裝過程

Cloning into "./vendor/hunzhiwange/framework"...
remote: Enumerating objects: 382, done.
remote: Counting objects: 100% (382/382), done.
remote: Compressing objects: 100% (218/218), done.
remote: Total 39304 (delta 196), reused 262 (delta 125), pack-reused 38922
Receiving objects: 100% (39304/39304), 14.49 MiB | 12.00 KiB/s, done.
Resolving deltas: 100% (27594/27594), done.

測試是否安裝成功

從新訪問首頁,如果可以訪問,那么恭喜你第一階段即安裝完畢。

php leevel server 
運行框架核心測試用例

QueryPHP 底層框架擁有 3000 多例測試用例,這些測試用例需要被維護,所以這里需要本地開發跑通測試用例。首先創建一個數據庫

可以用 Navicat For Mysql 創建一個數據庫 test.

CREATE DATABASE IF NOT EXISTS test DEFAULT CHARSET utf8 COLLATE utf8_general_ci;

復制一份配置文件并修改

cp ./tests/config.php ./tests/config.local.php

修改為

 "127.0.0.1",
    "PORT"     => 3306,
    "NAME"     => "test",
    "USER"     => "root",
    "PASSWORD" => "123456",
];


$GLOBALS["LEEVEL_ENV"]["CACHE"]["REDIS"] = [
    "HOST"     => "127.0.0.1",
    "PORT"     => 6380,
    "PASSWORD" => "123456",
];


$GLOBALS["LEEVEL_ENV"]["SESSION"]["REDIS"] = [
    "HOST"     => "127.0.0.1",
    "PORT"     => 6380,
    "PASSWORD" => "123456",
];

執行數據庫遷移命令

php vendor/bin/phinx migrate

安裝過程

Phinx by CakePHP - https://phinx.org. 0.9.2


using config file ./phinx.php
using config parser php
using migration paths
 - /data/codes/test/queryphp/vendor/hunzhiwange/framework/tests/assert/database/migrations
using seed paths
 - /data/codes/test/queryphp/vendor/hunzhiwange/framework/tests/assert/database/seeds
warning no environment specified, defaulting to: development
using adapter mysql
using database test


 == 20181010111946 User: migrating
 == 20181010111946 User: migrated 0.0076s


 == 20181011111926 Post: migrating
 == 20181011111926 Post: migrated 0.0101s


 == 20181011111937 Comment: migrating
 == 20181011111937 Comment: migrated 0.0106s


 == 20181011151247 PostContent: migrating
 == 20181011151247 PostContent: migrated 0.0087s


 == 20181011160957 Role: migrating
 == 20181011160957 Role: migrated 0.0078s


 == 20181011161035 UserRole: migrating
 == 20181011161035 UserRole: migrated 0.0100s


 == 20181031094608 CompositeId: migrating
 == 20181031094608 CompositeId: migrated 0.0094s


 == 20181107044153 GuestBook: migrating
 == 20181107044153 GuestBook: migrated 0.0086s


 == 20190424055915 TestUnique: migrating
 == 20190424055915 TestUnique: migrated 0.0133s


All Done. Took 0.1179s

運行測試用例

php ./build/phpunit

結果

注意隨著系統演進,測試用例會增加,輸出結果就有所不同。
PHPUnit 8.1.3 by Sebastian Bergmann and contributors.


==> TestsAuthHashTest                          ?  ?
==> TestsAuthManagerTest                       ?  ?  ?
==> TestsAuthMiddlewareAuthTest               ?  ?
==> TestsAuthProviderRegisterTest             ?
==> TestsAuthSessionTest                       ?  ?

...

==> TestsViewCompilerCompilerWhileTest        ?  ?
==> TestsViewHtmlTest                          ?  ?  ?  ?  ?  ?  ?  ?  ?
==> TestsViewManagerTest                       ?
==> TestsViewPhpuiTest                         ?  ?  ?  ?  ?  ?  ?  ?
==> TestsViewProviderRegisterTest             ?

Time: 19.51 seconds, Memory: 93.19 MB

Tests: 2978, Assertions: 10031, Failures: 0, Skipped: 6.
統一框架核心團隊代碼風格

風格統一對保證我們系統一致性非常重要,我們做到開箱即用,核心庫只包含 PHP 文件。

使用 Git 鉤子

cp ./build/pre-commit.sh ./.git/hooks/pre-commit
chmod 777 ./.git/hooks/pre-commit

測試自動化格式

tests/Name.php


Git 提交測試格式化

git add .
git commit -m "測試格式化"

運行過程

Checking PHP Lint...
No syntax errors detected in tests/Name.php
Running Code Sniffer...
Loaded config default from ".php_cs.dist".
Paths from configuration file have been overridden by paths provided as command arguments.
1) tests/Name.php Fixed all files in 0.009 seconds, 12.000 MB memory used
The file has been automatically formatted.
[master 20f2f845] 測試格式化
2 files changed, 29 insertions(+)
mode change 100644 => 100755 build/composer
create mode 100644 tests/Name.php
格式化后的 PHP

代碼干凈漂亮了不少,不是嗎。

測試代碼回滾請見上面的方法,謝謝。


* (c) 2010-2019 http://queryphp.com All rights reserved.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Test;

class Name
{
    public function demo($a = 1, $b = 4)
    {
        echo 1;
    }
}
克隆 queryphp.com 倉庫實現自動化文檔搭建

QueryPHP 底層的文檔基于單元測試加備注的方式來實現的,通過命名工具全部采用自動化生成 Markdown,這大幅度簡化了文檔的編寫工作,同時保證了文檔實時性。

官方文檔采用 VuePress 讀取 Markdown 來實現的

$cd /data/codes/test
$git clone git@github.com:hunzhiwange/queryphp.com.git

修改文檔工具生成 Markdown 的路徑

$cd /data/codes/test/queryphp
$vim .env


# 修改路徑
FRAMEWORK_DOC_OUTPUTDIR = "/data/codes/test/queryphp.com/docs/docs/"

生成文檔

$cd /data/codes/test/queryphp
$php leevel make:docwithin tests

運行過程

Class TestsEncryptionEncryptionTest was generate succeed.
Class TestsEncryptionSafeTest was generate succeed.
Class TestsDatabaseManagerTest was generate succeed.
Class TestsDatabaseDddUnitOfWorkTest was generate succeed.
Class TestsDatabaseDddCreateCreateTest was generate succeed.
Class TestsDatabaseQueryAggregateTest was generate succeed.
Class TestsValidateAssertTest was generate succeed.
Class TestsDiContainerTest was generate succeed.
Class TestsDocsBecomeAQueryphpDeveloperDoc was generate succeed.
Class TestsSupportFnTest was generate succeed.
Class TestsSupportStrTest was generate succeed.
Class TestsSupportArrTest was generate succeed.
Class TestsViewSummaryDoc was generate succeed.
Class TestsViewCompilerCompilerAssignTest was generate succeed.
Class TestsViewCompilerCompilerPhpTest was generate succeed.
Class TestsViewCompilerCompilerBreakTest was generate succeed.
Class TestsViewCompilerCompilerIncludeTest was generate succeed.
Class TestsViewCompilerCompilerTagselfTest was generate succeed.
Class TestsViewCompilerCompilerWhileTest was generate succeed.
Class TestsViewCompilerCompilerCssTest was generate succeed.
Class TestsViewCompilerCompilerForTest was generate succeed.
Class TestsViewCompilerCompilerVarTest was generate succeed.
Class TestsViewCompilerCompilerListTest was generate succeed.
Class TestsDebugDebugTest was generate succeed.
A total of 24 files generate succeed.

修改文檔菜單

$vim docs/.vuepress/config.js

運行本地文檔網站

訪問地址 localhost:8088 即可。

$npm install -g yarn
$yarn add -D vuepress # or npm install -D vuepress
$yarn run dev # or npx vuepress dev docs
結尾

到這里為止,我們本地開發環境已經全部搭建完畢,可以愉快地開發了。

::: tip
值得注意的是,我們通常在 dev 分支開發,開發完畢后 mergemaster 分支完成開發。
:::

文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。

轉載請注明本文地址:http://m.specialneedsforspecialkids.com/yun/31630.html

相關文章

  • QueryPHP V1-beta.3 完成 1.0.0 計劃功能凍結

    摘要:版本完成正式版前的除之外計劃功能,啟動凍結。百分之百單元測試覆蓋直面一劍封喉,基于實現框架常駐,依托生態實現業務常駐,此刻未來逐步漸進。 QueryPHP v1.0.0-beta. 版本完成 1.0 正式版前的除 Swoole 之外計劃功能,啟動凍結。下一版本專注 Swoole 協程改進。 關于 QueryPHP QueryPHP 是一款現代化的漸進式高性能 PHP 7 不僅僅是常駐框...

    ghnor 評論0 收藏0
  • QueryPHP V1-beta.1 部分文檔代碼解耦,版本PHP 7.3.2

    摘要:百分之百單元測試覆蓋直面一劍封喉,基于實現框架常駐,依托生態實現業務常駐,此刻未來逐步漸進。國際化例子函數隨機數字優化最開始采用的的繼承一個基礎的,方便單元測試有一定性能損失。 經過 1 個月的開發,QueryPHP v1.0.0-beta.1 版本可以發布了,這也是 beta 3 個版本的開始部分。這個版本的主要是代碼解耦和性能提升,文檔開發。 關于 QueryPHP QueryPH...

    lentrue 評論0 收藏0
  • 未來十年的云計算發展有什么期望?

    摘要:但有一件事將保持在所有名單的首位云計算。過去幾年,云計算提供商一直在努力擴大其地理覆蓋范圍。這最終會代表人們承諾的無縫混合世界嗎可以推測,今年云計算將發生很多變化,但關鍵原則和功能不會。這是新十年的開始,有新的預算和新的商業戰略。但有一件事將保持在所有CIO名單的首位:云計算。 去年,Gartner衡量了企業架構的成功,并規劃了其2020年的統治地位。它預測,今年市場將再增長17%,達...

    tuantuan 評論0 收藏0
  • 卷積神經網絡架構詳解:它與神經網絡有不同?

    摘要:較大池化一個卷積神經網絡的典型架構卷積神經網絡的典型架構我們已經討論過卷積層用表示和池化層用表示只是一個被應用的非線性特征,類似于神經網絡。 這是作者在 Medium 上介紹神經網絡系列文章中的一篇,他在這里詳細介紹了卷積神經網絡。卷積神經網絡在圖像識別、視頻識別、推薦系統以及自然語言處理中都有很廣的應用。如果想瀏覽該系列文章,可點擊閱讀原文查看原文網址。跟神經網絡一樣,卷積神經網絡由神經元...

    HackerShell 評論0 收藏0

發表評論

0條評論

最新活動
閱讀需要支付1元查看
<