Browse Source

reformat todo according to doxygen style

pull/2204/head
rabuzarus 6 years ago
parent
commit
3df5c17124
  1. 7
      include/Contact.php
  2. 6
      include/Photo.php
  3. 34
      include/api.php
  4. 2
      include/cron.php
  5. 2
      include/datetime.php
  6. 3
      include/dba.php
  7. 21
      include/diaspora.php
  8. 4
      include/email.php
  9. 2
      include/feed.php
  10. 33
      include/items.php
  11. 6
      include/msgclean.php
  12. 2
      include/network.php
  13. 2
      include/notifier.php
  14. 7
      include/onepoll.php
  15. 37
      include/ostatus.php
  16. 4
      include/plaintext.php
  17. 4
      include/poller.php
  18. 17
      include/socgraph.php
  19. 4
      include/uimport.php
  20. 2
      mod/api.php
  21. 4
      mod/directory.php
  22. 4
      mod/item.php
  23. 6
      mod/network.php
  24. 28
      mod/parse_url.php
  25. 2
      mod/uimport.php
  26. 84
      tests/autoname_test.php

7
include/Contact.php

@ -159,9 +159,10 @@ function mark_for_death($contact) {
}
else {
// TODO: We really should send a notification to the owner after 2-3 weeks
// so they won't be surprised when the contact vanishes and can take
// remedial action if this was a serious mistake or glitch
/// @todo
/// We really should send a notification to the owner after 2-3 weeks
/// so they won't be surprised when the contact vanishes and can take
/// remedial action if this was a serious mistake or glitch
$expiry = $contact['term-date'] . ' + 32 days ';
if(datetime_convert() > datetime_convert('UTC','UTC',$expiry)) {

6
include/Photo.php

@ -873,9 +873,9 @@ function store_photo($a, $uid, $imagedata = "", $url = "") {
$page_owner_nick = $r[0]['nickname'];
// To-Do:
// $default_cid = $r[0]['id'];
// $community_page = (($r[0]['page-flags'] == PAGE_COMMUNITY) ? true : false);
/// @TODO
/// $default_cid = $r[0]['id'];
/// $community_page = (($r[0]['page-flags'] == PAGE_COMMUNITY) ? true : false);
if ((strlen($imagedata) == 0) AND ($url == "")) {
logger("No image data and no url provided", LOGGER_DEBUG);

34
include/api.php

@ -1,7 +1,9 @@
<?php
/* To-Do:
- Automatically detect if incoming data is HTML or BBCode
*/
/**
* @file include/api.php
*
* @todo Automatically detect if incoming data is HTML or BBCode
*/
/* Contact details:
Gerhard Seeber Mail: gerhard@seeber.at Friendica: http://mozartweg.dyndns.org/friendica/gerhard
@ -261,7 +263,7 @@
}
function api_error(&$a, $type, $error) {
# TODO: https://dev.twitter.com/overview/api/response-codes
/// @TODO https://dev.twitter.com/overview/api/response-codes
$r = "<status><error>".$error."</error><request>".$a->query_string."</request></status>";
switch($type){
case "xml":
@ -880,7 +882,7 @@
$_REQUEST['body'] .= "\n\n".$media;
}
// To-Do: Multiple IDs
/// @TODO Multiple IDs
if (requestdata('media_ids')) {
$r = q("SELECT `resource-id`, `scale`, `nickname`, `type` FROM `photo` INNER JOIN `user` ON `user`.`uid` = `photo`.`uid` WHERE `resource-id` IN (SELECT `resource-id` FROM `photo` WHERE `id` = %d) AND `scale` > 0 AND `photo`.`uid` = %d ORDER BY `photo`.`width` DESC LIMIT 1",
intval(requestdata('media_ids')), api_user());
@ -1192,8 +1194,8 @@
*
* http://developer.twitter.com/doc/get/statuses/home_timeline
*
* TODO: Optional parameters
* TODO: Add reply info
* @TODO Optional parameters
* @TODO Add reply info
*/
function api_statuses_home_timeline(&$a, $type){
if (api_user()===false) return false;
@ -1725,8 +1727,8 @@
function api_favorites_create_destroy(&$a, $type){
if (api_user()===false) return false;
# for versioned api.
# TODO: we need a better global soluton
// for versioned api.
/// @TODO We need a better global soluton
$action_argv_id=2;
if ($a->argv[1]=="1.1") $action_argv_id=3;
@ -2013,10 +2015,8 @@
}
function api_get_entitities(&$text, $bbcode) {
/*
To-Do:
* Links at the first character of the post
*/
/// @todo
/// Links at the first character of the post
$a = get_app();
@ -2871,10 +2871,8 @@ function api_share_as_retweet(&$item) {
}
function api_get_nick($profile) {
/* To-Do:
- remove trailing junk from profile url
- pump.io check has to check the website
*/
/// @TODO Remove trailing junk from profile url
/// @TODO pump.io check has to check the website
$nick = "";
@ -2922,7 +2920,7 @@ function api_get_nick($profile) {
}
}
// To-Do: look at the page if its really a pumpio site
/// @TODO Look at the page if its really a pumpio site
//if (!$nick == "") {
// $pumpio = preg_replace("=https?://(.*)/(.*)/=ism", "$2", $profile."/");
// if ($pumpio != $profile)

2
include/cron.php

@ -140,7 +140,7 @@ function cron_run(&$argv, &$argc){
// update nodeinfo data
nodeinfo_cron();
// To-Do: Regenerate usage statistics
/// @TODO Regenerate usage statistics
// q("ANALYZE TABLE `item`");
// once daily run birthday_updates and then expire in background

2
include/datetime.php

@ -377,7 +377,7 @@ function get_first_dim($y,$m) {
// Months count from 1.
// TODO: provide (prev,next) links, define class variations for different size calendars
/// @TODO Provide (prev,next) links, define class variations for different size calendars
if(! function_exists('cal')) {

3
include/dba.php

@ -14,8 +14,7 @@ if(class_exists('\PDO') && in_array('mysql', PDO::getAvailableDrivers())) {
require_once('include/datetime.php');
/**
*
* MySQL database class
* @class MySQL database class
*
* For debugging, insert 'dbg(1);' anywhere in the program flow.
* dbg(0); will turn it off. Logging is performed at LOGGER_DATA level.

21
include/diaspora.php

@ -1,9 +1,10 @@
<?php
/*
To-Do:
- GET /people/9aed8882b9f64896/stream
*/
/**
* @file include/diaspora.php
*
* @todo GET /people/9aed8882b9f64896/stream
*/
require_once('include/crypto.php');
require_once('include/items.php');
@ -1017,8 +1018,8 @@ function diaspora_store_by_guid($guid, $server, $uid = 0) {
DiasporaFetchGuid($datarray);
$message_id = item_store($datarray);
// To-Do:
// Looking if there is some subscribe mechanism in Diaspora to get all comments for this post
/// @TODO
/// Looking if there is some subscribe mechanism in Diaspora to get all comments for this post
return $message_id;
}
@ -1088,8 +1089,8 @@ function diaspora_fetch_message($guid, $server, $level = 0) {
$body = scale_external_images($body);
// Add OEmbed and other information to the body
// To-Do: It could be a repeated redmatrix item
// Then we shouldn't add further data to it
/// @TODO It could be a repeated redmatrix item
/// Then we shouldn't add further data to it
if ($item["object-type"] == ACTIVITY_OBJ_NOTE)
$body = add_page_info_to_body($body, false, true);
@ -2462,8 +2463,8 @@ function diaspora_profile($importer,$xml,$msg) {
if(substr($birthday,5) === substr($contact['bd'],5))
$birthday = $contact['bd'];
// TODO: update name on item['author-name'] if the name changed. See consume_feed()
// Not doing this currently because D* protocol is scheduled for revision soon.
/// @TODO Update name on item['author-name'] if the name changed. See consume_feed()
/// (Not doing this currently because D* protocol is scheduled for revision soon).
$r = q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s', `avatar-date` = '%s' , `bd` = '%s', `location` = '%s', `about` = '%s', `keywords` = '%s', `gender` = '%s' WHERE `id` = %d AND `uid` = %d",
dbesc($name),

4
include/email.php

@ -251,9 +251,9 @@ function email_header_encode($in_str, $charset) {
/**
* email_send is used by NETWORK_EMAIL and NETWORK_EMAIL2 code
* (not to notify the user, but to send items to email contacts
* (not to notify the user, but to send items to email contacts)
*
* TODO: this could be changed to use the Emailer class
* @todo This could be changed to use the Emailer class
*/
function email_send($addr, $subject, $headers, $item) {
//$headers .= 'MIME-Version: 1.0' . "\n";

2
include/feed.php

@ -210,7 +210,7 @@ function feed_import($xml,$importer,&$contact, &$hub) {
continue;
}
// To-Do?
/// @TODO ?
// <category>Ausland</category>
// <media:thumbnail width="152" height="76" url="http://www.taz.de/picture/667875/192/14388767.jpg"/>

33
include/items.php

@ -1097,10 +1097,13 @@ function add_guid($item) {
dbesc($item["uri"]), dbesc($item["network"]));
}
// Adds a "lang" specification in a "postopts" element of given $arr,
// if possible and not already present.
// Expects "body" element to exist in $arr.
// TODO: add a parameter to request forcing override
/**
* Adds a "lang" specification in a "postopts" element of given $arr,
* if possible and not already present.
* Expects "body" element to exist in $arr.
*
* @todo Add a parameter to request forcing override
*/
function item_add_language_opt(&$arr) {
if (version_compare(PHP_VERSION, '5.3.0', '<')) return; // LanguageDetect.php not available ?
@ -1110,7 +1113,7 @@ function item_add_language_opt(&$arr) {
if ( strstr($arr['postopts'], 'lang=') )
{
// do not override
// TODO: add parameter to request overriding
/// @TODO Add parameter to request overriding
return;
}
$postopts = $arr['postopts'];
@ -3228,11 +3231,11 @@ function local_delivery($importer,$data) {
return 1;
}
// TODO
// merge with current record, current contents have priority
// update record, set url-updated
// update profile photos
// schedule a scan?
/// @TODO
/// merge with current record, current contents have priority
/// update record, set url-updated
/// update profile photos
/// schedule a scan?
return 0;
}
@ -4515,11 +4518,11 @@ function atom_entry($item,$type,$author,$owner,$comment = false,$cid = 0) {
$o .= '<category scheme="X-DFRN:' . xmlify($t[0]) . ':' . xmlify($t[1]) . '" term="' . xmlify($t[2]) . '" />' . "\r\n";
}
// To-Do:
// To support these elements, the API needs to be enhanced
//$o .= '<link rel="ostatus:conversation" href="'.xmlify($a->get_baseurl().'/display/'.$owner['nickname'].'/'.$item['parent']).'"/>'."\r\n";
//$o .= "\t".'<link rel="self" type="application/atom+xml" href="'.xmlify($a->get_baseurl().'/api/statuses/show/'.$item['id'].'.atom').'"/>'."\r\n";
//$o .= "\t".'<link rel="edit" type="application/atom+xml" href="'.xmlify($a->get_baseurl().'/api/statuses/show/'.$item['id'].'.atom').'"/>'."\r\n";
/// @TODO
/// To support these elements, the API needs to be enhanced
/// $o .= '<link rel="ostatus:conversation" href="'.xmlify($a->get_baseurl().'/display/'.$owner['nickname'].'/'.$item['parent']).'"/>'."\r\n";
/// $o .= "\t".'<link rel="self" type="application/atom+xml" href="'.xmlify($a->get_baseurl().'/api/statuses/show/'.$item['id'].'.atom').'"/>'."\r\n";
/// $o .= "\t".'<link rel="edit" type="application/atom+xml" href="'.xmlify($a->get_baseurl().'/api/statuses/show/'.$item['id'].'.atom').'"/>'."\r\n";
// Deactivated since it was meant only for OStatus
//$o .= item_get_attachment($item);

6
include/msgclean.php

@ -127,9 +127,9 @@ function removesig($message)
if (($sigpos < $quotepos) and ($sigpos != 0))
return(array('body' => $message, 'sig' => ''));
// To-Do: Regexp umstellen, so dass auf 1 oder kein Leerzeichen
// geprueft wird
//$message = str_replace("\n--\n", "\n-- \n", $message);
/// @TODO Regexp umstellen, so dass auf 1 oder kein Leerzeichen
/// geprueft wird
/// $message = str_replace("\n--\n", "\n-- \n", $message);
$pattern = '/(.*)[\r\n]-- [\r\n](.*)/is';

2
include/network.php

@ -587,7 +587,7 @@ function lrdd($uri, $debug = false) {
$lines = explode("\n",$headers);
if(count($lines)) {
foreach($lines as $line) {
// TODO alter the following regex to support multiple relations (space separated)
/// @TODO Alter the following regex to support multiple relations (space separated)
if((stristr($line,'link:')) && preg_match('/<([^>].*)>.*rel\=[\'\"]lrdd[\'\"]/',$line,$matches)) {
$pagelink = $matches[1];
break;

2
include/notifier.php

@ -966,7 +966,7 @@ function notifier_run(&$argv, &$argc){
if($url) {
logger('notifier: urldelivery: ' . $url);
$deliver_status = slapper($owner,$url,$slap);
// TODO: redeliver/queue these items on failure, though there is no contact record
/// @TODO Redeliver/queue these items on failure, though there is no contact record
}
}
}

7
include/onepoll.php

@ -109,9 +109,8 @@ function onepoll_run(&$argv, &$argc){
poco_load($contact['id'],$importer_uid,0,$contact['poco']);
}
// To-Do:
// - Check why we don't poll the Diaspora feed at the moment (some guid problem in the items?)
// - Check whether this is possible with Redmatrix
/// @TODO Check why we don't poll the Diaspora feed at the moment (some guid problem in the items?)
/// @TODO Check whether this is possible with Redmatrix
if ($contact["network"] == NETWORK_DIASPORA) {
if (poco_do_update($contact["created"], $contact["last-item"], $contact["failure_update"], $contact["success_update"])) {
$last_updated = poco_last_updated($contact["url"]);
@ -507,7 +506,7 @@ function onepoll_run(&$argv, &$argc){
logger("Mail: Importing ".$msg_uid." for ".$mailconf[0]['user']);
// some mailing lists have the original author as 'from' - add this sender info to msg body.
// todo: adding a gravatar for the original author would be cool
/// @TODO Adding a gravatar for the original author would be cool
if(! stristr($meta->from,$contact['addr'])) {
$from = imap_mime_header_decode($meta->from);

37
include/ostatus.php

@ -298,8 +298,8 @@ function ostatus_import($xml,$importer,&$contact, &$hub) {
$item["object"] = $xml;
$item["verb"] = $xpath->query('activity:verb/text()', $entry)->item(0)->nodeValue;
// To-Do:
// Delete a message
/// @TODO
/// Delete a message
if ($item["verb"] == "qvitter-delete-notice") {
// ignore "Delete" messages (by now)
logger("Ignore delete message ".print_r($item, true));
@ -361,8 +361,8 @@ function ostatus_import($xml,$importer,&$contact, &$hub) {
if ($georsspoint)
$item["coord"] = $georsspoint->item(0)->nodeValue;
// To-Do
// $item["location"] =
/// @TODO
/// $item["location"] =
$categories = $xpath->query('atom:category', $entry);
if ($categories) {
@ -833,7 +833,7 @@ function ostatus_completion($conversation_url, $uid, $item = array()) {
$existing_message = $message_exists[0];
// We improved the way we fetch OStatus messages, this shouldn't happen very often now
// To-Do: we have to change the shadow copies as well. This way here is really ugly.
/// @TODO We have to change the shadow copies as well. This way here is really ugly.
if ($existing_message["parent"] != $parent["id"]) {
logger('updating id '.$existing_message["id"].' with parent '.$existing_message["parent"].' to parent '.$parent["id"].' uri '.$parent["uri"].' thread '.$parent_uri, LOGGER_DEBUG);
@ -886,7 +886,7 @@ function ostatus_completion($conversation_url, $uid, $item = array()) {
logger("No contact found for url ".$actor, LOGGER_DEBUG);
// Adding a global contact
// To-Do: Use this data for the post
/// @TODO Use this data for the post
$global_contact_id = get_contact($actor, 0);
logger("Global contact ".$global_contact_id." found for url ".$actor, LOGGER_DEBUG);
@ -1153,11 +1153,11 @@ function ostatus_add_header($doc, $owner) {
$attributes = array("href" => $owner["url"], "rel" => "alternate", "type" => "text/html");
xml_add_element($doc, $root, "link", "", $attributes);
// To-Do: We have to find out what this is
//$attributes = array("href" => $a->get_baseurl()."/sup",
// "rel" => "http://api.friendfeed.com/2008/03#sup",
// "type" => "application/json");
//xml_add_element($doc, $root, "link", "", $attributes);
/// @TODO We have to find out what this is
/// $attributes = array("href" => $a->get_baseurl()."/sup",
/// "rel" => "http://api.friendfeed.com/2008/03#sup",
/// "type" => "application/json");
/// xml_add_element($doc, $root, "link", "", $attributes);
ostatus_hublinks($doc, $root);
@ -1311,12 +1311,11 @@ function ostatus_add_author($doc, $owner, $profile) {
return $author;
}
/*
To-Do: Picture attachments should look like this:
<a href="https://status.pirati.ca/attachment/572819" title="https://status.pirati.ca/file/heluecht-20151202T222602-rd3u49p.gif"
class="attachment thumbnail" id="attachment-572819" rel="nofollow external">https://status.pirati.ca/attachment/572819</a>
/**
* @TODO Picture attachments should look like this:
* <a href="https://status.pirati.ca/attachment/572819" title="https://status.pirati.ca/file/heluecht-20151202T222602-rd3u49p.gif"
* class="attachment thumbnail" id="attachment-572819" rel="nofollow external">https://status.pirati.ca/attachment/572819</a>
*
*/
function ostatus_entry($doc, $item, $owner, $toplevel = false) {
@ -1461,8 +1460,8 @@ function ostatus_entry($doc, $item, $owner, $toplevel = false) {
ostatus_get_attachment($doc, $entry, $item);
// To-Do:
// The API call has yet to be implemented
/// @TODO
/// The API call has yet to be implemented
//$attributes = array("href" => $a->get_baseurl()."/api/statuses/show/".$item["id"].".atom",
// "rel" => "self", "type" => "application/atom+xml");
//xml_add_element($doc, $entry, "link", "", $attributes);

4
include/plaintext.php

@ -106,8 +106,8 @@ function get_attached_data($body) {
}
function shortenmsg($msg, $limit, $twitter = false) {
// To-Do:
// For Twitter URLs aren't shortened, but they have to be calculated as if.
/// @TODO
/// For Twitter URLs aren't shortened, but they have to be calculated as if.
$lines = explode("\n", $msg);
$msg = "";

4
include/poller.php

@ -56,8 +56,8 @@ function poller_run(&$argv, &$argc){
q("UPDATE `workerqueue` SET `executed` = '0000-00-00 00:00:00', `pid` = 0 WHERE `pid` = %d",
intval($pid["pid"]));
else {
// To-Do: Kill long running processes
// But: Update processes (like the database update) mustn't be killed
/// @TODO Kill long running processes
/// But: Update processes (like the database update) mustn't be killed
}
} else

17
include/socgraph.php

@ -1,15 +1,16 @@
<?php
/**
* @file include/socgraph.php
*
* @todo Move GNU Social URL schemata (http://server.tld/user/number) to http://server.tld/username
* @todo Fetch profile data from profile page for Redmatrix users
* @todo Detect if it is a forum
*/
require_once('include/datetime.php');
require_once("include/Scrape.php");
require_once("include/html2bbcode.php");
/*
To-Do:
- Move GNU Social URL schemata (http://server.tld/user/number) to http://server.tld/username
- Fetch profile data from profile page for Redmatrix users
- Detect if it is a forum
*/
/*
* poco_load
@ -131,7 +132,7 @@ function poco_load($cid,$uid = 0,$zcid = 0,$url = null) {
$keywords = implode(", ", $tag);
// If you query a Friendica server for its profiles, the network has to be Friendica
// To-Do: It could also be a Redmatrix server
/// TODO It could also be a Redmatrix server
//if ($uid == 0)
// $network = NETWORK_DFRN;
@ -1244,7 +1245,7 @@ function update_suggestions() {
$done = array();
// To-Do: Check if it is really neccessary to poll the own server
/// TODO Check if it is really neccessary to poll the own server
poco_load(0,0,0,$a->get_baseurl() . '/poco');
$done[] = $a->get_baseurl() . '/poco';

4
include/uimport.php

@ -195,10 +195,10 @@ function import_account(&$a, $file) {
// send relocate message (below)
break;
case NETWORK_ZOT:
// TODO handle zot network
/// @TODO handle zot network
break;
case NETWORK_MAIL2:
// TODO ?
/// @TODO ?
break;
case NETWORK_FEED:
case NETWORK_MAIL:

2
mod/api.php

@ -85,7 +85,7 @@ function api_content(&$a) {
if(! local_user()) {
//TODO: we need login form to redirect to this page
/// @TODO We need login form to redirect to this page
notice( t('Please login to continue.') . EOL );
return login(false,$request->get_parameters());
}

4
mod/directory.php

@ -130,8 +130,8 @@ function directory_content(&$a) {
// show if account is a community account
// ToDo the other should be also respected, but first we need a good translatiion
// and systemwide consistency for displaying the page type
/// @TODO The other page types should be also respected, but first we need a good
/// translatiion and systemwide consistency for displaying the page type
if((intval($rr['page-flags']) == PAGE_COMMUNITY) OR (intval($rr['page-flags']) == PAGE_PRVGROUP))
$community = true;

4
mod/item.php

@ -176,10 +176,6 @@ function item_post(&$a) {
// have been provided, and run any anti-spam plugins
// TODO
if((! can_write_wall($a,$profile_uid)) && (! $allow_moderated)) {
notice( t('Permission denied.') . EOL) ;

6
mod/network.php

@ -312,7 +312,7 @@ function network_content(&$a, $update = 0) {
return login(false);
}
// TODO:is this really necessary? $a is already available to hooks
/// @TODO Is this really necessary? $a is already available to hooks
$arr = array('query' => $a->query_string);
call_hooks('network_content_init', $arr);
@ -346,8 +346,8 @@ function network_content(&$a, $update = 0) {
$o = '';
// item filter tabs
// TODO: fix this logic, reduce duplication
//$a->page['content'] .= '<div class="tabs-wrapper">';
/// @TODO fix this logic, reduce duplication
/// $a->page['content'] .= '<div class="tabs-wrapper">';
list($no_active, $all_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active, $spam_active) = network_query_get_sel_tab($a);
// if no tabs are selected, defaults to comments

28
mod/parse_url.php

@ -1,16 +1,20 @@
<?php
/* To-Do
https://developers.google.com/+/plugins/snippet/
<meta itemprop="name" content="Toller Titel">
<meta itemprop="description" content="Eine tolle Beschreibung">
<meta itemprop="image" content="http://maple.libertreeproject.org/images/tree-icon.png">
<body itemscope itemtype="http://schema.org/Product">
<h1 itemprop="name">Shiny Trinket</h1>
<img itemprop="image" src="{image-url}" />
<p itemprop="description">Shiny trinkets are shiny.</p>
</body>
/**
* @file mod/parse_url.php
*
* @todo https://developers.google.com/+/plugins/snippet/
*
* @verbatim
* <meta itemprop="name" content="Toller Titel">
* <meta itemprop="description" content="Eine tolle Beschreibung">
* <meta itemprop="image" content="http://maple.libertreeproject.org/images/tree-icon.png">
*
* <body itemscope itemtype="http://schema.org/Product">
* <h1 itemprop="name">Shiny Trinket</h1>
* <img itemprop="image" src="{image-url}" />
* <p itemprop="description">Shiny trinkets are shiny.</p>
* </body>
* @endverbatim
*/
if(!function_exists('deletenode')) {

2
mod/uimport.php

@ -29,7 +29,7 @@ function uimport_post(&$a) {
}
if (x($_FILES,'accountfile')){
// TODO: pass $blocked / $verified, send email to admin on REGISTER_APPROVE
/// @TODO Pass $blocked / $verified, send email to admin on REGISTER_APPROVE
import_account($a, $_FILES['accountfile']);
return;
}

84
tests/autoname_test.php

@ -15,62 +15,62 @@ require_once('include/text.php');
* @package test.util
*/
class AutonameTest extends PHPUnit_Framework_TestCase {
/**
*autonames should be random, even length
*/
public function testAutonameEven() {
$autoname1=autoname(10);
$autoname2=autoname(10);
$this->assertNotEquals($autoname1, $autoname2);
}
/**
*autonames should be random, odd length
*/
public function testAutonameOdd() {
$autoname1=autoname(9);
$autoname2=autoname(9);
$this->assertNotEquals($autoname1, $autoname2);
}
/**
* try to fail autonames
*/
public function testAutonameNoLength() {
$autoname1=autoname(0);
$this->assertEquals(0, strlen($autoname1));
}
/**
*autonames should be random, even length
*/
public function testAutonameEven() {
$autoname1=autoname(10);
$autoname2=autoname(10);
$this->assertNotEquals($autoname1, $autoname2);
}
/**
*autonames should be random, odd length
*/
public function testAutonameOdd() {
$autoname1=autoname(9);
$autoname2=autoname(9);
$this->assertNotEquals($autoname1, $autoname2);
}
/**
* try to fail autonames
*/
public function testAutonameNoLength() {
$autoname1=autoname(0);
$this->assertEquals(0, strlen($autoname1));
}
/**
* try to fail it with invalid input
*
* TODO: What's corect behaviour here? An exception?
*/
public function testAutonameNegativeLength() {
$autoname1=autoname(-23);
$this->assertEquals(0, strlen($autoname1));
}
// public function testAutonameMaxLength() {
// $autoname2=autoname(PHP_INT_MAX);
// $this->assertEquals(PHP_INT_MAX, count($autoname2));
// }
*/
public function testAutonameNegativeLength() {
$autoname1=autoname(-23);
$this->assertEquals(0, strlen($autoname1));
}
// public function testAutonameMaxLength() {
// $autoname2=autoname(PHP_INT_MAX);
// $this->assertEquals(PHP_INT_MAX, count($autoname2));
// }
/**
* test with a length, that may be too short
*/
public function testAutonameLength1() {
$autoname1=autoname(1);
*/
public function testAutonameLength1() {
$autoname1=autoname(1);
$this->assertEquals(1, count($autoname1));
$autoname2=autoname(1);
$autoname2=autoname(1);
$this->assertEquals(1, count($autoname2));
// The following test is problematic, with only 26 possibilities
// generating the same thing twice happens often aka
// birthday paradox
// $this->assertFalse($autoname1==$autoname2);
// $this->assertFalse($autoname1==$autoname2);
}
}
Loading…
Cancel
Save