{"action":"created","issue":{"url":"https://api.github.com/repos/jhedstrom/DrupalDriver/issues/3","labels_url":"https://api.github.com/repos/jhedstrom/DrupalDriver/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/jhedstrom/DrupalDriver/issues/3/comments","events_url":"https://api.github.com/repos/jhedstrom/DrupalDriver/issues/3/events","html_url":"https://github.com/jhedstrom/DrupalDriver/pull/3","id":52373926,"number":3,"title":"Provide an interface for the random string generator","user":{"login":"pfrenssen","id":442924,"avatar_url":"https://avatars.githubusercontent.com/u/442924?v=3","gravatar_id":"","url":"https://api.github.com/users/pfrenssen","html_url":"https://github.com/pfrenssen","followers_url":"https://api.github.com/users/pfrenssen/followers","following_url":"https://api.github.com/users/pfrenssen/following{/other_user}","gists_url":"https://api.github.com/users/pfrenssen/gists{/gist_id}","starred_url":"https://api.github.com/users/pfrenssen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pfrenssen/subscriptions","organizations_url":"https://api.github.com/users/pfrenssen/orgs","repos_url":"https://api.github.com/users/pfrenssen/repos","events_url":"https://api.github.com/users/pfrenssen/events{/privacy}","received_events_url":"https://api.github.com/users/pfrenssen/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2014-12-18T15:09:50Z","updated_at":"2015-01-23T17:46:11Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/jhedstrom/DrupalDriver/pulls/3","html_url":"https://github.com/jhedstrom/DrupalDriver/pull/3","diff_url":"https://github.com/jhedstrom/DrupalDriver/pull/3.diff","patch_url":"https://github.com/jhedstrom/DrupalDriver/pull/3.patch"},"body":"The random string generator `\\Drupal\\Component\\Utility\\Random` is currently hardcoded in the project. It would be better if this conformed to an interface so it can be properly injected. This would allow us to override it, and it allow the methods to be autocompleted by IDEs."},"comment":{"url":"https://api.github.com/repos/jhedstrom/DrupalDriver/issues/comments/71232798","html_url":"https://github.com/jhedstrom/DrupalDriver/pull/3#issuecomment-71232798","issue_url":"https://api.github.com/repos/jhedstrom/DrupalDriver/issues/3","id":71232798,"user":{"login":"pfrenssen","id":442924,"avatar_url":"https://avatars.githubusercontent.com/u/442924?v=3","gravatar_id":"","url":"https://api.github.com/users/pfrenssen","html_url":"https://github.com/pfrenssen","followers_url":"https://api.github.com/users/pfrenssen/followers","following_url":"https://api.github.com/users/pfrenssen/following{/other_user}","gists_url":"https://api.github.com/users/pfrenssen/gists{/gist_id}","starred_url":"https://api.github.com/users/pfrenssen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pfrenssen/subscriptions","organizations_url":"https://api.github.com/users/pfrenssen/orgs","repos_url":"https://api.github.com/users/pfrenssen/repos","events_url":"https://api.github.com/users/pfrenssen/events{/privacy}","received_events_url":"https://api.github.com/users/pfrenssen/received_events","type":"User","site_admin":false},"created_at":"2015-01-23T17:46:11Z","updated_at":"2015-01-23T17:46:11Z","body":"I have used rych-random in a previous project but we eventually abandoned it for a self rolled solution since it is rather basic. What is very nice about it is that it scans your system for available random number generators and will use the best available.\r\n\r\nWe decided to abandon it because in testing it is very interesting to be able to retrieve valid data as well as invalid data, and also to be able to extend it so you can test things like URLs, email addresses etc.\r\n\r\nThis is the interface we used, it served us pretty well (ref http://cgit.drupalcode.org/paddle_selenium_tests/tree/testdataprovider/Kanooh/TestDataProvider/TestDataProviderInterface.php?h=7.x-1.x):\r\n\r\n```\r\n<?php\r\n\r\n\r\n/**\r\n * @file\r\n * Contains \\Kanooh\\TestDataProvider\\TestDataProviderInterface.\r\n */\r\n\r\nnamespace Kanooh\\TestDataProvider;\r\n\r\n/**\r\n * Interface for TestDataProvider classes.\r\n */\r\ninterface TestDataProviderInterface\r\n{\r\n    /**\r\n     * Returns an array of valid test data.\r\n     *\r\n     * @return array\r\n     *   An array of valid test data.\r\n     */\r\n    public function getValidDataSet();\r\n\r\n    /**\r\n     * Returns an array of invalid test data.\r\n     *\r\n     * @return array\r\n     *   An array of invalid test data.\r\n     */\r\n    public function getInvalidDataSet();\r\n\r\n    /**\r\n     * Returns a random value from the valid data set.\r\n     *\r\n     * @return mixed\r\n     *   A valid value.\r\n     */\r\n    public function getValidValue();\r\n\r\n    /**\r\n     * Returns a random value from the invalid data set.\r\n     *\r\n     * @return mixed\r\n     *   An invalid value.\r\n     */\r\n    public function getInvalidValue();\r\n}\r\n```\r\n\r\nThis can be coupled with a base class that implements `getValidValue()` and `getInvalidValue()`.\r\n\r\nHere is the full set of classes: http://cgit.drupalcode.org/paddle_selenium_tests/tree/testdataprovider/Kanooh/TestDataProvider?h=7.x-1.x"}}