Git Product home page Git Product logo

php-before-dependency-injection's Introduction

php-before-dependency-injection

Build Status

準備

1. cloneするかzipファイルをダウンロードしたら、以下コマンドを実行します

$ cd php-before-dependency-injection
$ composer install

2. 以下ddl文を mysql のテスト用スキーマに流してテーブルを作ります

CREATE TABLE IF NOT EXISTS `sample` (
    `id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
    `name` TEXT NOT NULL ,
    `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,
    `updated_at` TIMESTAMP NULL DEFAULT NULL ,
    PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

※ data/test_sample_ddl.sql をmysqlコマンドで流してもいいです

設定ファイルの修正

1. .env ファイルを src/config/ に作ります

$ cp ./src/config/.env.example ./src/config/.env

2. .env にDBの接続設定を書きます

$ vim ./src/config/.env
DB_DSN=mysql:host=localhost:3306;dbname=test;charset=utf8; # Your DB DSN
DB_USER=root  # Your DB USER
DB_PASS=  # Your DB PASSWORD

3. phpunit.xml を修正します (DB_DSN, DB_USER, DB_PASS)

$ vim ./phpunit.xml
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
         ・・・
         stopOnFailure="false">
    <php>
        <!-- Your DB Setting -->
        <var name="DB_DSN" value="mysql:host=localhost:3306;dbname=test;charset=utf8;" />
        <var name="DB_USER" value="root" />
        <var name="DB_PASS" value="" />
        <!-- Your DB Setting -->
    </php>
    ・・・
</phpunit>

実行

$ ./vendor/bin/phpunit --group sample

License

  • MIT License

php-before-dependency-injection's People

Contributors

shimabox avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.