How to run single test method with phpunit?

前端 未结 13 2194
猫巷女王i
猫巷女王i 2020-11-30 16:13

I am struggling to run a single test method named testSaveAndDrop in the file escalation/EscalationGroupTest.php with phpunit. I tried

13条回答
  •  半阙折子戏
    2020-11-30 17:05

    for run phpunit test in laravel by many way ..

    vendor/bin/phpunit --filter methodName className pathTofile.php
    
    vendor/bin/phpunit --filter 'namespace\\directoryName\\className::methodName'
    

    for test single class :

    vendor/bin/phpunit --filter  tests/Feature/UserTest.php
    vendor/bin/phpunit --filter 'Tests\\Feature\\UserTest'
    vendor/bin/phpunit --filter 'UserTest' 
    

    for test single method :

     vendor/bin/phpunit --filter testExample 
     vendor/bin/phpunit --filter 'Tests\\Feature\\UserTest::testExample'
     vendor/bin/phpunit --filter testExample UserTest tests/Feature/UserTest.php
    

    for run tests from all class within namespace :

    vendor/bin/phpunit --filter 'Tests\\Feature'
    

    for more way run test see more

提交回复
热议问题