Giter Site home page Giter Site logo

phpspec_sample's Introduction

  • composer上で、PSR-4対応のオートロード設定をする。

    • composer.json上で、以下のように記載
    "autoload": {
        "psr-4": {
            "SampleProject\\": "src/"
        }
    }
    
  • テストスケルトンの作成は、以下のようにする(名前空間/(...)/クラス名の形式) vendor/bin/phpspec describe SampleProject/Hoge/Foo

  • 特定ディレクトリや特定クラスのテストだけ行いたい場合、以下のようにする。

    • まとめて実行 vendor/bin/phpspec run
    • 特定クラスだけ実行 vendor/bin/phpspec run spec/Hoge/FooSpec.php
    • 特定ディレクトリ以下のテストだけ実行 vendor/bin/phpspec run spec/Hoge
    • 参考
  • PSR-4に対応させるには?

    • 次のようなphpspec.ymlという名称のファイルを、プロジェクト直下に作る。
    • ファイルの中身は以下のように記載。
    suites:                             
        data_mediator_suite:            # 1つ以上のsuiteを記載。名称は何でも良いようだ。
            namespace: SampleProject\    # 名前空間(複数suiteを記載した場合 namespaceキーを使ってsuiteのマッチが行われる模様。)
            psr4_prefix: SampleProject\  # PSR-4での名前空間
            #spec_path: spec            # 各テストファイルの既定パス。デフォルト値はspec。
            #src_path: src              # ソースの基底パス。デフォルト値はsrc。
    

    Test Your Trait With PHP Spec

phpspec_sample's People

Contributors

th1209 avatar

Watchers

James Cloos 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.