Extending WP_UnitTestCase without any Tests

You just need to define the MZMBO_UnitTestCase class as abstract: abstract class MZMBO_UnitTestCase extends WP_UnitTestCase { public function el($message){ file_put_contents(‘./log_’.date(“j.n.Y”).’.log’, $message, FILE_APPEND); } }

What is the best way to create a factory for unit test objects?

If I undertsand correctly, what you are searching for is a good library for creating stubs and mocks. If you use PHPUnit, it has a features for that. See https://phpunit.de/manual/current/en/test-doubles.html#test-doubles For example, let’s assume you have a class like this: namespace MyApp; class MyCustomUser { public function __construct(\WP_User $user) { $this->user = $user; } public … Read more