Automattic / wordbless

WorDBless allows you to use WordPress core functions in your PHPUnit tests without having to set up a database and the whole WordPress environment
Other
131 stars 6 forks source link

Co-oping with johnpbloch/wordpress, how? #60

Open lkraav opened 1 year ago

lkraav commented 1 year ago

If my project is already using johnpbloch/wordpress as dependency, how's this going to work out? Seems like I would need to maintain a wordbless fork with roots/wordpress swapped out? Or maybe some composer magic can send roots/wordpress to /dev/null automatically :thinking:

szepeviktor commented 1 year ago

Hello Leho! 😆 This is also a viktor-supported project.

You could create a stub package (in form of 1 local composer.json file) that "provide": the Roots package. May I create that file for you?

szepeviktor commented 1 year ago

Turns out no need for a fake package, it can be done in the main project.

{
    "name": "cxl/lehos-trick",
    "description": "https://github.com/Automattic/wordbless/issues/60",
    "require": {
        "automattic/wordbless": "^0.4.1",
        "johnpbloch/wordpress": "^6.1"
    },
    "provide": {
        "roots/wordpress": "^6.0.2"
    },
    "config": {
        "allow-plugins": {
            "johnpbloch/wordpress-core-installer": true
        }
    }
}
automattic/wordbless 0.4.1 WorDBless allows you to ...
├──php >=5.6.20
└──roots/wordpress ^6.0.2
johnpbloch/wordpress 6.1.1 WordPress is open source software ...
├──johnpbloch/wordpress-core 6.1.1
│  ├──ext-json *
│  └──php >=5.6.20
├──johnpbloch/wordpress-core-installer ^1.0 || ^2.0
│  ├──composer-plugin-api ^1.0 || ^2.0
│  └──php >=5.6.0
└──php >=5.6.20
lkraav commented 1 year ago

Turns out no need for a fake package, it can be done in the main project.

Thanks I will test this and report back.