sokil / php-mongo

MongoDB ODM. Part of @PHPMongoKit
http://phpmongokit.github.io/
MIT License
242 stars 46 forks source link

Use PHPUnit\Framework\TestCase instead of PHPUnit_Framework_TestCase #161

Closed carusogabriel closed 6 years ago

carusogabriel commented 6 years ago

I use the PHPUnit\Framework\TestCase notation instead of PHPUnit_Framework_TestCase while extending our TestCases. This will help us migrate to PHPUnit 6, that no longer support snake case class names.

I just need to bump PHPUnit version to >=4.8.35, that support this namespace.

sokil commented 6 years ago

phpunit is in require-dev section. How can in conflict with your composer.json?

carusogabriel commented 6 years ago

@sokil Sorry, I didn't get your question :disappointed:

sokil commented 6 years ago

You have an application, which require "sokil/php-mongo" and you need in your application phpunit/phpunit" >=4.8.35. How phpunit of this lib may affect your phpunit, configuration section require-dev used only if composer package is root (not reuiredby other package)? I don't understand your problem

carusogabriel commented 6 years ago

Ah, okay, got it. I change this requirement, not because of other people applications, but ours, to keep our suite of tests up and running

sokil commented 6 years ago

but your tests in on your application. how dev reuirement of this lib may interfere you to update version of phpunit in composer.json of your app?

carusogabriel commented 6 years ago

It won't affect. I just require a minimum version because of the new namespaces, and in the future, when we decide to update to PHPUnit 6, it's easier

sokil commented 6 years ago

Create app:

$ composer.init

Then require PHPMongo:

composer.phar require sokil/php-mongo

Then require PHPUnit:

composer.phar require phpunit/phpunit

Everything installs fine. Resulting composer.json:

{
    "name": "root/test",
    "authors": [
        {
            "name": "Dmytro Sokil",
            "email": "dmytro.sokil@gmail.com"
        }
    ],
    "require": {
        "sokil/php-mongo": "^1.22",
        "phpunit/phpunit": "^6.4"
    }
}

and all is fine.

carusogabriel commented 6 years ago

I guess we are not getting each other point. Let me try to be more clear: this new PHPUnit\Framework\TestCase namespace is new in some PHPUnit versions. I know that someone requires phpunit/phpunit in their composer.json, it will be overwritten, but, for us, developing php-mongo and running vendor/bin/phpunit, it is needed

sokil commented 6 years ago

Strange day o_O