Skip to content
This repository was archived by the owner on Jun 15, 2022. It is now read-only.

Commit 086aa82

Browse files
committed
Install WooCommerce as a dev dependency via Composer, and ensure its test framework is available.
Since WooCommerce requires WordPress to be loaded in a certain way, we're better off extending WC_Unit_Test_Case instead of WP_UnitTestCase, since that's the base test case for WooCommerce core. This commit also includes composer.lock in the repo, as it's designed to be included in version control.
1 parent 20fd3d7 commit 086aa82

File tree

4 files changed

+235
-4
lines changed

4 files changed

+235
-4
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
/vendor
2-
composer.lock
1+
tests/coverage
2+
vendor

composer.json

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,18 @@
77
"composer/installers": "^1.4",
88
"xrstf/composer-php52": "^1.0"
99
},
10+
"require-dev": {
11+
"woocommerce/woocommerce": "dev-master"
12+
},
1013
"autoload": {
11-
"classmap": ["includes"]
14+
"classmap": [
15+
"includes"
16+
]
17+
},
18+
"autoload-dev": {
19+
"classmap": [
20+
"vendor/woocommerce/woocommerce/tests/framework"
21+
]
1222
},
1323
"scripts": {
1424
"post-install-cmd": [
@@ -20,5 +30,12 @@
2030
"post-autoload-dump": [
2131
"xrstf\\Composer52\\Generator::onPostInstallCmd"
2232
]
33+
},
34+
"extra": {
35+
"installer-paths": {
36+
"vendor/{$vendor}/{$name}": [
37+
"woocommerce/woocommerce"
38+
]
39+
}
2340
}
2441
}

composer.lock

Lines changed: 214 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testcase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* @author Liquid Web
77
*/
88

9-
class TestCase extends WP_UnitTestCase {
9+
class TestCase extends WC_Unit_Test_Case {
1010

1111
/**
1212
* Determine if the custom orders table exists.

0 commit comments

Comments
 (0)