Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit testing framework #1485

Closed
brandonkelly opened this issue Mar 11, 2017 · 10 comments
Closed

Unit testing framework #1485

brandonkelly opened this issue Mar 11, 2017 · 10 comments
Assignees
Labels
enhancement improvements to existing features

Comments

@brandonkelly
Copy link
Member

No description provided.

@brandonkelly brandonkelly added enhancement improvements to existing features and removed misc labels May 9, 2017
@yp28
Copy link

yp28 commented Jul 28, 2017

To be able to test properly, you need to be able to mock dependencies. And to be able to do that, quite some code has to be changed to implement dependency injection.

Is there a plan to implement this and make proper unit testing possible?

@dougstjohn
Copy link
Contributor

Do you have more information on what we can expect in the 3.0 GA for this testing framework? We're adding unit, API, and end-to-end testing to several Craft plugins and client projects. What can we expect in this initial release?

@boboldehampsink
Copy link
Contributor

@yp28 not necessarily. In Yii2 you can override components, and thus mock them.

@yp28
Copy link

yp28 commented Apr 10, 2018

@boboldehampsink I sure hope that's not where this is headed 😅

Edit: anyway, turns out 3.0 was released with hardly any unit tests. Is it still the plan to add this in the near future, @brandonkelly?

@boboldehampsink
Copy link
Contributor

@yp28 Its worrying enough that Craft itself doesn't have tests 😅

@dougstjohn
Copy link
Contributor

Will be interesting to see the impact of Yii2.1 also which changes routing, adds dependency injection, adds middleware, etc. Details here https://github.com/yiisoft/yii2/milestones/2.1.0

@boboldehampsink
Copy link
Contributor

Here is a Craft 3 plugin that uses the Codeception testing framework and is able to mock services: https://github.com/nerds-and-company/schematic

@martinherweg
Copy link

Still no news on that? Would love to be able to develop modules or plugins test driven :)

@cmalven
Copy link

cmalven commented Oct 28, 2018

I'm very interested in using Craft as an application development framework, but the lack of an officially-supported story for testing plugins and modules makes it a tough sell.

brandonkelly added a commit that referenced this issue Jun 4, 2019
@gtettelaar
Copy link
Contributor

gtettelaar commented Jun 4, 2019

As of Craft 3.2 BETA-1, there is now a formalized testing Framework for Craft. Based on Codeception with support for sites, modules and plugins in various testing styles.

Formal announcement here

Big +1 for @boboldehampsink for his help on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement improvements to existing features
Projects
None yet
Development

No branches or pull requests

9 participants