Your code needs to test for the categories_id or master_categories_id depending on how you need to use this ...
The code I posted just tells you where all of the tests need to be done ...
You need to write the actual tests for your specific needs ...
Without actually sitting down and writing all of the code for you ... it would be difficult to tell you everything you need to do for your specific needs ...



