[owncloud-devel] Help improving how php-classes and tests work in oC

Joas Schilling nickvergessen at owncloud.com
Mon Dec 1 10:35:43 GMT 2014


Hi there fellow-coders,

Copied from a comment on github:
- Please no longer add execution code to class files, e.g.
https://github.com/owncloud/core/commit/fca9d32545c933d3a262c1d49b44a805589de882#diff-4
- Please no longer wrap classes with conditions (all classes should
exist in all installations, independent from OS and other stuff), e.g.
https://github.com/owncloud/core/commit/fca9d32545c933d3a262c1d49b44a805589de882#diff-8

if you need to do one of the above, we did something wrong elsewhere.
Feel free to ask for help, to avoid this bad coding style.

Please also use 1 file per php class, so they can easily be autoloaded
and use namespaces for new classes.
This also applies for tests: tests/lib/ has the Namespace \Test\

When writing tests please always extend \Test\TestCase and call
parent::setUp(), setUpBeforeClass, tearDown and tearDownAfterClass when
overwriting these methods, to make sure the clean up (and potential new
other stuff) we do with the test case class is being done.

cheers Joas



More information about the Devel mailing list