arangodb / arangodb-php

PHP ODM for ArangoDB
https://www.arangodb.com
Apache License 2.0
183 stars 43 forks source link

Aren't those implemented tests rather integration tests than unit tests? #171

Closed olivermack closed 7 years ago

olivermack commented 10 years ago

Hey,

those tests implemented yet are quite extensive and have many dependencies in one tested logical unit. The GraphBasicTest for example does neither test the Graph class, nor the GraphHandler class directly; instead it addresses an integration of both of them. The GraphExtendedTest does so, too.

So, I'm asking myself if it would be nice to differ between unit and integration tests (or: to implement unit tests which follow some more of those best practices known).

What do you think? Any opinions on that?

Cheers

frankmayer commented 10 years ago

Hey Oliver,

great, that you're offering an extra set of eyes :)

Since it's a driver, I liked the "integration" tests a lot, as they covered the complete request/response cycle, to the server.

However if you like to also write some real unit tests, please do so. The more, the better :)

Greetings

olivermack commented 10 years ago

Hey @frankmayer,

as I've seen now (and I'm just scratching the surface: implementing tests for the second class) there are issues in the code which are making the implementation of good ol' unit tests a little pain in the ass (sorry). I stumbled over codes that have plenty of hardcoded dependencies which means that they cannot be mocked easily, such as static helpers called in constructors to name one (e.g. HttpResponse.php which is a very central part).

Are there any refactorings planned for this lib? Maybe when your ArangoDB-PHP-Core is finished and some of the central parts of the current driver's lib may be/are obsolete? I'd like to see the official PHP driver for arangodb to be more S.O.L.I.D. and I'm willing to support where I can (at least at some points :)).

Cheers

frankmayer commented 7 years ago

Closing this, as an implementation of real unit tests with the current state of the driver seems difficult. If there should be any changes to the state of the driver we may re-open this.

As for the ArangoDB-PHP-Core driver, there was no time to develop it further, but there might be some time now.