Tags icon indicating copy to clipboard operation
Tags copied to clipboard

Tests failing when using model with TagBehavior

Open LubosRemplik opened this issue 7 years ago • 1 comments

I am getting following errors when running app test on Users controller, which uses Users Table with TagBehavior loaded

RuntimeException: Field "tag_count" does not exist in table "users"

Test setUp

    public function setUp()
     {
         parent::setUp();
         $request = new ServerRequest();
         $response = new Response();
         $this->controller = new UsersController($request, $response);
         $event = new Event('Controller.beforeFilter', $this->controller);
         $this->controller->beforeFilter($event);
         $event = new Event('Controller.beforeRender', $this->controller);
         $this->controller->beforeRender($event);
     }

Possible fix:

  • removing above exception?
  • I can load the Table without behavior for that controller for the test, but I think it is better to load default behaviors

LubosRemplik avatar Feb 06 '18 10:02 LubosRemplik

Check your fixture if it has the field.

burzum avatar May 17 '18 12:05 burzum