{"action":"created","issue":{"url":"https://api.github.com/repos/nette/tester/issues/133","labels_url":"https://api.github.com/repos/nette/tester/issues/133/labels{/name}","comments_url":"https://api.github.com/repos/nette/tester/issues/133/comments","events_url":"https://api.github.com/repos/nette/tester/issues/133/events","html_url":"https://github.com/nette/tester/pull/133","id":34240883,"number":133,"title":"Optional custom fail messages in asserts","user":{"login":"MartinMystikJonas","id":2094752,"avatar_url":"https://avatars.githubusercontent.com/u/2094752?v=3","gravatar_id":"","url":"https://api.github.com/users/MartinMystikJonas","html_url":"https://github.com/MartinMystikJonas","followers_url":"https://api.github.com/users/MartinMystikJonas/followers","following_url":"https://api.github.com/users/MartinMystikJonas/following{/other_user}","gists_url":"https://api.github.com/users/MartinMystikJonas/gists{/gist_id}","starred_url":"https://api.github.com/users/MartinMystikJonas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MartinMystikJonas/subscriptions","organizations_url":"https://api.github.com/users/MartinMystikJonas/orgs","repos_url":"https://api.github.com/users/MartinMystikJonas/repos","events_url":"https://api.github.com/users/MartinMystikJonas/events{/privacy}","received_events_url":"https://api.github.com/users/MartinMystikJonas/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/nette/tester/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":42,"created_at":"2014-05-24T19:33:47Z","updated_at":"2015-08-05T10:16:29Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/nette/tester/pulls/133","html_url":"https://github.com/nette/tester/pull/133","diff_url":"https://github.com/nette/tester/pull/133.diff","patch_url":"https://github.com/nette/tester/pull/133.patch"},"body":"Sometimes test results can be hard to understand without detail examination of test code.\r\n\r\nFor example:\r\n```PHP\r\nAssert::true($obj->isA());\r\nAssert::true($obj->isB());\r\n```\r\n\r\nYou just get something like: \r\n```\r\n   Failed: FALSE should be TRUE\r\n   \r\n   in Tester/Framework/Assert.php(370) \r\n   in Tester/Framework/Assert.php(141) Tester\\Assert::fail()\r\n   in tests/common/SomeTest.phpt(18) Tester\\Assert::true()\r\n```\r\n\r\nOnly information about what caused tha failure is line number on last line.\r\n\r\nAlso there are some cases when assertion is executed multiple times (for example asserting something for every item in collection) where we need to know for which item test failed.\r\n\r\nTherefore it is usefull to have option to add custom fail messafe to asserts.\r\n\r\n```PHP\r\nAssert::true($obj->isA(), \"Object is A\");\r\nAssert::true($obj->isB(), \"Object is B\");\r\n```\r\n\r\nAnd then you get:\r\nYou jsut get something like: \r\n```\r\n   Failed: Object is B: FALSE should be TRUE\r\n   \r\n   in Tester/Framework/Assert.php(370) \r\n   in Tester/Framework/Assert.php(141) Tester\\Assert::fail()\r\n   in tests/common/SomeTest.phpt(18) Tester\\Assert::true()\r\n```\r\n\r\nIt could save you lot of time in examining test results.\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/nette/tester/issues/comments/127948269","html_url":"https://github.com/nette/tester/pull/133#issuecomment-127948269","issue_url":"https://api.github.com/repos/nette/tester/issues/133","id":127948269,"user":{"login":"MartinMystikJonas","id":2094752,"avatar_url":"https://avatars.githubusercontent.com/u/2094752?v=3","gravatar_id":"","url":"https://api.github.com/users/MartinMystikJonas","html_url":"https://github.com/MartinMystikJonas","followers_url":"https://api.github.com/users/MartinMystikJonas/followers","following_url":"https://api.github.com/users/MartinMystikJonas/following{/other_user}","gists_url":"https://api.github.com/users/MartinMystikJonas/gists{/gist_id}","starred_url":"https://api.github.com/users/MartinMystikJonas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MartinMystikJonas/subscriptions","organizations_url":"https://api.github.com/users/MartinMystikJonas/orgs","repos_url":"https://api.github.com/users/MartinMystikJonas/repos","events_url":"https://api.github.com/users/MartinMystikJonas/events{/privacy}","received_events_url":"https://api.github.com/users/MartinMystikJonas/received_events","type":"User","site_admin":false},"created_at":"2015-08-05T10:16:28Z","updated_at":"2015-08-05T10:16:28Z","body":"done"}}