项目作者: agungsijawir

项目描述 :
Simple demo message queue
高级语言: PHP
项目地址: git://github.com/agungsijawir/queuejob-example.git
创建时间: 2017-08-12T13:03:16Z
项目社区:https://github.com/agungsijawir/queuejob-example

开源协议:Other

下载






Yii 2 Queue Job Example




Yii 2 Queue Job Example menggunakan skeleton Yii 2 untuk
demonstrasi handle queue job.

Latest Stable Version
Total Downloads
Build Status

DIRECTORY STRUCTURE

  1. assets/ contains assets definition
  2. commands/ contains console commands (controllers)
  3. config/ contains application configurations
  4. controllers/ contains Web controller classes
  5. mail/ contains view files for e-mails
  6. models/ contains model classes
  7. runtime/ contains files generated during runtime
  8. tests/ contains various tests for the basic application
  9. vendor/ contains dependent 3rd-party packages
  10. views/ contains view files for the Web application
  11. web/ contains the entry script and Web resources

REQUIREMENTS

Minimum requirements untuk menjalankan project ini adalah Web Server dengan dukungan PHP 5.4.0.

Beanstalkd server terinstall dan aktif. Rujuk ke petunjuk instalasi beanstalkd.

CONFIGURATION

Database

Ubah file config/db.php dengan pengaturan database:

  1. return [
  2. 'class' => 'yii\db\Connection',
  3. 'dsn' => 'mysql:host=localhost;dbname=yii2basic',
  4. 'username' => 'root',
  5. 'password' => '1234',
  6. 'charset' => 'utf8',
  7. ];

Cek juga file config/params.php untuk konfigurasi beanstalkd instance.

NOTES:

  • Yii tidak akan membuat database untuk Anda. Proses pembuatan database harus dilakukan secara manual sebelum Anda
    mengakses / melakukan migration.
  • Cek dan edit file lainnya dalam direktori config/ untuk kostumasi project Anda.
  • Silakan rujuk ke README di direktori tests untuk informasi spesifik mengenai TDD Testing proyek ini.

TESTING

Tests are located in tests directory. They are developed with Codeception PHP Testing Framework.
By default there are 3 test suites:

  • unit
  • functional
  • acceptance

Tests can be executed by running

  1. vendor/bin/codecept run

The command above will execute unit and functional tests. Unit tests are testing the system components, while functional
tests are for testing user interaction. Acceptance tests are disabled by default as they require additional setup since
they perform testing in real browser.

Running acceptance tests

To execute acceptance tests do the following:

  1. Rename tests/acceptance.suite.yml.example to tests/acceptance.suite.yml to enable suite configuration

  2. Replace codeception/base package in composer.json with codeception/codeception to install full featured
    version of Codeception

  3. Update dependencies with Composer

    1. composer update
  4. Download Selenium Server and launch it:

    1. java -jar ~/selenium-server-standalone-x.xx.x.jar

    In case of using Selenium Server 3.0 with Firefox browser since v48 or Google Chrome since v53 you must download GeckoDriver or ChromeDriver and launch Selenium with it:

    1. # for Firefox
    2. java -jar -Dwebdriver.gecko.driver=~/geckodriver ~/selenium-server-standalone-3.xx.x.jar
    3. # for Google Chrome
    4. java -jar -Dwebdriver.chrome.driver=~/chromedriver ~/selenium-server-standalone-3.xx.x.jar

    As an alternative way you can use already configured Docker container with older versions of Selenium and Firefox:

    1. docker run --net=host selenium/standalone-firefox:2.53.0
  5. (Optional) Create yii2_basic_tests database and update it by applying migrations if you have them.

    1. tests/bin/yii migrate

    The database configuration can be found at config/test_db.php.

  1. Start web server:

    1. tests/bin/yii serve
  2. Now you can run all available tests

    1. # run all available tests
    2. vendor/bin/codecept run
    3. # run acceptance tests
    4. vendor/bin/codecept run acceptance
    5. # run only unit and functional tests
    6. vendor/bin/codecept run unit,functional

Code coverage support

By default, code coverage is disabled in codeception.yml configuration file, you should uncomment needed rows to be able
to collect code coverage. You can run your tests and collect coverage with the following command:

  1. #collect coverage for all tests
  2. vendor/bin/codecept run -- --coverage-html --coverage-xml
  3. #collect coverage only for unit tests
  4. vendor/bin/codecept run unit -- --coverage-html --coverage-xml
  5. #collect coverage for unit and functional tests
  6. vendor/bin/codecept run functional,unit -- --coverage-html --coverage-xml

You can see code coverage output under the tests/_output directory.