{"action":"created","issue":{"url":"https://api.github.com/repos/dmitryd/typo3-realurl/issues/8","labels_url":"https://api.github.com/repos/dmitryd/typo3-realurl/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/dmitryd/typo3-realurl/issues/8/comments","events_url":"https://api.github.com/repos/dmitryd/typo3-realurl/issues/8/events","html_url":"https://github.com/dmitryd/typo3-realurl/issues/8","id":75397420,"number":8,"title":"Unit tests","user":{"login":"witrin","id":1394346,"avatar_url":"https://avatars.githubusercontent.com/u/1394346?v=3","gravatar_id":"","url":"https://api.github.com/users/witrin","html_url":"https://github.com/witrin","followers_url":"https://api.github.com/users/witrin/followers","following_url":"https://api.github.com/users/witrin/following{/other_user}","gists_url":"https://api.github.com/users/witrin/gists{/gist_id}","starred_url":"https://api.github.com/users/witrin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/witrin/subscriptions","organizations_url":"https://api.github.com/users/witrin/orgs","repos_url":"https://api.github.com/users/witrin/repos","events_url":"https://api.github.com/users/witrin/events{/privacy}","received_events_url":"https://api.github.com/users/witrin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-05-11T23:48:18Z","updated_at":"2015-05-17T08:08:41Z","closed_at":null,"body":"I assume the development is not test driven, is there a chance for unit tests in the future?"},"comment":{"url":"https://api.github.com/repos/dmitryd/typo3-realurl/issues/comments/102766678","html_url":"https://github.com/dmitryd/typo3-realurl/issues/8#issuecomment-102766678","issue_url":"https://api.github.com/repos/dmitryd/typo3-realurl/issues/8","id":102766678,"user":{"login":"dmitryd","id":306133,"avatar_url":"https://avatars.githubusercontent.com/u/306133?v=3","gravatar_id":"","url":"https://api.github.com/users/dmitryd","html_url":"https://github.com/dmitryd","followers_url":"https://api.github.com/users/dmitryd/followers","following_url":"https://api.github.com/users/dmitryd/following{/other_user}","gists_url":"https://api.github.com/users/dmitryd/gists{/gist_id}","starred_url":"https://api.github.com/users/dmitryd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmitryd/subscriptions","organizations_url":"https://api.github.com/users/dmitryd/orgs","repos_url":"https://api.github.com/users/dmitryd/repos","events_url":"https://api.github.com/users/dmitryd/events{/privacy}","received_events_url":"https://api.github.com/users/dmitryd/received_events","type":"User","site_admin":false},"created_at":"2015-05-17T08:08:41Z","updated_at":"2015-05-17T08:08:41Z","body":"Let me comment :)\r\n\r\n## Encapsulate URLs\r\nI am not sure how this will help. URL is just a string. May be, you can tell more about the idea.\r\n\r\n## Move helper methods\r\nCommon methods are already extracted to a base class (EncodeDecodeBase). Other methods are quite integrated: they use instance variables to do their work. I'd prefer to keep the classes focused. Tests are suplemental, they should not complicate the code or introduce obstacles.\r\n\r\n## Segment processing\r\nAll xxxVars are handled by the same code. I do not see what can be extracted here.\r\n\r\n## Other thoughts\r\nTo me the best way to make tests would be:\r\n* Be able to test RealURL as a whole: pass a source URL to it and test that the result matches.\r\n* Be able to test certain key functions (like path encoding/decoding or xxxVar encoding/decoding). This will be extremely useful exclusion from path is implemented.\r\n\r\nIn general I feel that unit testing would be complicated. RealURL requires rootline in many cases. Probably, that can be extracted first. Than tests would be able to give a fake rootline and provide stable results for all tests. Test rootline provider can return all kind of rootlines are required by tests (for example, with mount points or with excluded segments).\r\n\r\nI think we should be really careful when we implement tests. The main goal of RealURL is \"real life\" encoding and decoding, which should be fast and reliable. If tests somehow screw up tests, it would not be good."}}