Mockery exception: could not load mock class already exists

Mockery\Exception\RuntimeException: Could not load mock , class already exists

When working with those spaghetti legacy code base, sometimes, it is fucking hard to write the test along with refactoring. We may face with some situation that need to mock the public static function call.

And the test class:

We use mockery to mock the static function call, run the test with single function, it’s green.
But, if we run the whole test case, it will throw:

So, to deal with this exception, add these annotation runInSeparateProcess preserveGlobalState

BAAM, it’s will green again if we run whole test case. Those 2 annotation will help mockery get rid of duplicating instance of Utils class (in this context)

These are some references from the phpunit document:

SEO Bot baiting from idea to practice

  1. What the hell is BOT:
    • Those big giant search engine has there own bot for scrapping all the data of the website everyday
    • Understanding how the search engine bot works will help us a lot when doing SEO
  2. Bot Bating concept:
  3. Implementation:
  4. SEO improvement: (google crawling freq increase)

from the image below, we can see that /electrolux/do-gia-dung/may-giat-ui crawling freq increase from 4 to 5, then 11


5. Website implemented this Bot baiting technique: