Yii Framework Forum: Tests for Console Commands - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Tests for Console Commands How do you test console commands via codeception?

#1 User is offline   nima_naraghi 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 185
  • Joined: 15-March 13
  • Location:Iran, Tehran

Posted 14 July 2017 - 05:55 AM

Hi

I have no clue how to create a test for a console command in Yii2 neither unit test nor functional test. Can someone show me an example or a guide please ?

Update:
How can I run a command controller in test environment ?

Cheers
0

#2 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,165
  • Joined: 17-January 09
  • Location:Russia

Posted 15 July 2017 - 04:10 AM

Check how its done in Yii core tests.
Yii 2.0 Development Cookbook

Enjoying Yii? Star us at github

Support me so I work on Yii fulltime: https://www.patreon.com/samdark
0

#3 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 3,655
  • Joined: 10-October 10
  • Location:Denmark

Posted 04 September 2017 - 02:37 PM

It does not look like Yii is using Codeception at all, which is a shame (considering that it is the de facto testing framework for the framework). :)
"Less noise - more signal"
0

#4 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,165
  • Joined: 17-January 09
  • Location:Russia

Posted 05 September 2017 - 08:41 AM

Yii is using it for testing app templates. For unit testing, indeed pure phpunit is used. There will be no difference if you'll run these tests using Codeception though...
Yii 2.0 Development Cookbook

Enjoying Yii? Star us at github

Support me so I work on Yii fulltime: https://www.patreon.com/samdark
1

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users