{"action":"created","issue":{"url":"https://api.github.com/repos/CakeDC/utils/issues/138","labels_url":"https://api.github.com/repos/CakeDC/utils/issues/138/labels{/name}","comments_url":"https://api.github.com/repos/CakeDC/utils/issues/138/comments","events_url":"https://api.github.com/repos/CakeDC/utils/issues/138/events","html_url":"https://github.com/CakeDC/utils/issues/138","id":81405040,"number":138,"title":"SoftDeleteBehavior & Unit Testing = Error: Table users for model User was not found in datasource test.","user":{"login":"ravage84","id":625761,"avatar_url":"https://avatars.githubusercontent.com/u/625761?v=3","gravatar_id":"","url":"https://api.github.com/users/ravage84","html_url":"https://github.com/ravage84","followers_url":"https://api.github.com/users/ravage84/followers","following_url":"https://api.github.com/users/ravage84/following{/other_user}","gists_url":"https://api.github.com/users/ravage84/gists{/gist_id}","starred_url":"https://api.github.com/users/ravage84/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ravage84/subscriptions","organizations_url":"https://api.github.com/users/ravage84/orgs","repos_url":"https://api.github.com/users/ravage84/repos","events_url":"https://api.github.com/users/ravage84/events{/privacy}","received_events_url":"https://api.github.com/users/ravage84/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-05-27T11:13:07Z","updated_at":"2015-06-04T23:06:41Z","closed_at":null,"body":"I ran into the following problem using the SoftDeleteBehavior:\r\n\r\nWhen a model has an association with another one and you want to unit test one of them, you will run into an error message like:\r\n\r\n> Error: Table users for model User was not found in datasource test.\r\n\r\nI created a test app to showcase the problem:\r\nhttps://github.com/ravage84/softdeletebbehavior-prob\r\n\r\nWay to reproduce:\r\n- Checkout repo\r\n- Create DBs for default & test datasource\r\n- Setup database config\r\n- ``php console\\cake.php schema create``\r\n- ``php console\\cake.php test app Model/Post --stderr``\r\n\r\nTested with CakePHP 2.6.1, 2.6.5, 2.5.8 & 2.4.10.using the dev-master of CakeDCs SoftDeleteBehavior or @dereuromark 's version at https://github.com/dereuromark/cakephp-tools/blob/2.5/Model/Behavior/SoftDeleteBehavior.php\r\n\r\nThe problem was already mentioned here:\r\nhttps://github.com/dereuromark/cakephp-tools/issues/135\r\n"},"comment":{"url":"https://api.github.com/repos/CakeDC/utils/issues/comments/109084337","html_url":"https://github.com/CakeDC/utils/issues/138#issuecomment-109084337","issue_url":"https://api.github.com/repos/CakeDC/utils/issues/138","id":109084337,"user":{"login":"ravage84","id":625761,"avatar_url":"https://avatars.githubusercontent.com/u/625761?v=3","gravatar_id":"","url":"https://api.github.com/users/ravage84","html_url":"https://github.com/ravage84","followers_url":"https://api.github.com/users/ravage84/followers","following_url":"https://api.github.com/users/ravage84/following{/other_user}","gists_url":"https://api.github.com/users/ravage84/gists{/gist_id}","starred_url":"https://api.github.com/users/ravage84/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ravage84/subscriptions","organizations_url":"https://api.github.com/users/ravage84/orgs","repos_url":"https://api.github.com/users/ravage84/repos","events_url":"https://api.github.com/users/ravage84/events{/privacy}","received_events_url":"https://api.github.com/users/ravage84/received_events","type":"User","site_admin":false},"created_at":"2015-06-04T23:06:41Z","updated_at":"2015-06-04T23:06:41Z","body":"Also I assume your code works because you don't do import the fixtures from the model anymore as I do:\r\nhttps://github.com/ravage84/softdeletebbehavior-prob/blob/6ea9b3f65d89f2a7e665931603ad7094d74bee24/app/Test/Fixture/PostFixture.php#L13\r\n\r\nYou probably chose a different option when you re-baked them..."}}