Using My Own Classes On Wp Unit Tests

6 . Added this 2 lines to
/wordpress-develop/tests/phpunit/includes/functions.php

require_once('src/wp-content/themes/THEMENAME/include/PostType.php');
require_once('src/wp-content/themes/THEMENAME/include/Konser.php');

That is the problem. The get_post() function doesn’t exist, becuase the phpunit/includes/functions.php file is included before WordPress is loaded. That is actually part of the reason that it exists as a separate file: so it can be included in your own phpunit bootstrap (if you need one, and need to use those functions). For an example of how this is done for plugins, you can see a tutorial I’ve written.

However, in your case, you are testing a theme, and your test suite is not complex enough that it warrants its own bootstrap. Actually, your third step, adding define( 'WP_DEFAULT_THEME', 'THEMENAME' ); to the wp-tests-config.php should be sufficient. The two files you’re requireing will automatically be loaded as part of your theme. (Yes, the theme is loaded during the unit tests.)

So your mistake was step 6. It isn’t necessary.