Browse Source

test commits optimization

new-struct
John 7 years ago
parent
commit
f85f1c5597
15 changed files with 318 additions and 20330 deletions
  1. +6
    -2
      .travis.yml
  2. +0
    -19522
      install/geo_base.sql
  3. +0
    -707
      install/sql.sql
  4. +158
    -1
      tests/AbstractFixtures.php
  5. +13
    -0
      tests/LoadFixtures.php
  6. +4
    -15
      tests/behat/features/comment.feature
  7. +59
    -0
      tests/behat/features/comment.feature.incomplete
  8. +9
    -1
      tests/fixtures/BlogFixtures.php
  9. +24
    -0
      tests/fixtures/CategoryFixtures.php
  10. +28
    -0
      tests/fixtures/CommentFixtures.php
  11. +16
    -52
      tests/fixtures/TopicFixtures.php
  12. +0
    -27
      tests/fixtures/UserFixtures.php
  13. +0
    -1
      tests/fixtures/sql/geo_base.sql
  14. +0
    -1
      tests/fixtures/sql/sql.sql
  15. +1
    -1
      tests/travis/mysql_setup.sh

+ 6
- 2
.travis.yml View File

@@ -13,9 +13,12 @@ before_script:
- chmod -R 0777 ./uploads
- chmod -R 0777 ./templates/cache/
- chmod -R 0777 ./templates/compiled/
- cp ./install/*.sql tests/fixtures/sql/
- rm -rf ./install

# install required PHP stuff
- sudo apt-get install php5 php5-cli php5-mysql php5-mcrypt php5-xsl php5-xdebug php-apc php5-gd php5-curl php5-intl
- sudo apt-get update
- sudo apt-get install php5 php5-cli php5-mysql php5-mcrypt php5-xsl php5-xdebug php-apc php5-gd php5-curl php5-intl mysql-server mysql-client

# launch apache, MySQL and PHPUnit Selenium installers
- ./tests/travis/apache_setup.sh
@@ -28,6 +31,7 @@ before_script:
- sleep 5

# get HTML of main page (for debug)

- firefox --version
- wget -S http://livestreet.test -O /dev/null

@@ -36,7 +40,7 @@ before_script:
- sleep 5

# download and launch Selenium
- wget -O /tmp/selenium-server-standalone.jar http://selenium.googlecode.com/files/selenium-server-standalone-2.31.0.jar
- wget -O /tmp/selenium-server-standalone.jar http://selenium.dev.stfalcon.com/selenium-server-standalone-latest.jar
- java -jar /tmp/selenium-server-standalone.jar > /dev/null &
- sleep 5



+ 0
- 19522
install/geo_base.sql
File diff suppressed because it is too large
View File


+ 0
- 707
install/sql.sql View File

@@ -1,1031 +0,0 @@



CREATE TABLE IF NOT EXISTS `prefix_blog` (
`blog_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`user_owner_id` int(11) unsigned NOT NULL,
`blog_title` varchar(200) NOT NULL,
`blog_description` text NOT NULL,
`blog_type` enum('personal','open','invite','close') DEFAULT 'personal',
`blog_date_add` datetime NOT NULL,
`blog_date_edit` datetime DEFAULT NULL,
`blog_rating` float(9,3) NOT NULL DEFAULT '0.000',
`blog_count_vote` int(11) unsigned NOT NULL DEFAULT '0',
`blog_count_user` int(11) unsigned NOT NULL DEFAULT '0',
`blog_count_topic` int(10) unsigned NOT NULL DEFAULT '0',
`blog_limit_rating_topic` float(9,3) NOT NULL DEFAULT '0.000',
`blog_url` varchar(200) DEFAULT NULL,
`blog_avatar` varchar(250) DEFAULT NULL,
PRIMARY KEY (`blog_id`),
KEY `user_owner_id` (`user_owner_id`),
KEY `blog_type` (`blog_type`),
KEY `blog_url` (`blog_url`),
KEY `blog_title` (`blog_title`),
KEY `blog_count_topic` (`blog_count_topic`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;


INSERT INTO `prefix_blog` (`blog_id`, `user_owner_id`, `blog_title`, `blog_description`, `blog_type`, `blog_date_add`, `blog_date_edit`, `blog_rating`, `blog_count_vote`, `blog_count_user`, `blog_count_topic`, `blog_limit_rating_topic`, `blog_url`, `blog_avatar`) VALUES
(1, 1, 'Blog by admin', 'This is your personal blog.', 'personal', '2012-08-07 00:00:00', NULL, 0.000, 0, 0, 0, -1000.000, NULL, '0');



CREATE TABLE IF NOT EXISTS `prefix_blog_user` (
`blog_id` int(11) unsigned NOT NULL,
`user_id` int(11) unsigned NOT NULL,
`user_role` int(3) DEFAULT '1',
UNIQUE KEY `blog_id_user_id_uniq` (`blog_id`,`user_id`),
KEY `blog_id` (`blog_id`),
KEY `user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;





CREATE TABLE IF NOT EXISTS `prefix_comment` (
`comment_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`comment_pid` int(11) unsigned DEFAULT NULL,
`comment_left` int(11) NOT NULL DEFAULT '0',
`comment_right` int(11) NOT NULL DEFAULT '0',
`comment_level` int(11) NOT NULL DEFAULT '0',
`target_id` int(11) unsigned DEFAULT NULL,
`target_type` enum('topic','talk') NOT NULL DEFAULT 'topic',
`target_parent_id` int(11) NOT NULL DEFAULT '0',
`user_id` int(11) unsigned NOT NULL,
`comment_text` text NOT NULL,
`comment_text_hash` varchar(32) NOT NULL,
`comment_date` datetime NOT NULL,
`comment_user_ip` varchar(20) NOT NULL,
`comment_rating` float(9,3) NOT NULL DEFAULT '0.000',
`comment_count_vote` int(11) unsigned NOT NULL DEFAULT '0',
`comment_count_favourite` int(11) unsigned NOT NULL DEFAULT '0',
`comment_delete` tinyint(4) NOT NULL DEFAULT '0',
`comment_publish` tinyint(1) NOT NULL DEFAULT '1',
PRIMARY KEY (`comment_id`),
KEY `comment_pid` (`comment_pid`),
KEY `type_date_rating` (`target_type`,`comment_date`,`comment_rating`),
KEY `id_type` (`target_id`,`target_type`),
KEY `type_delete_publish` (`target_type`,`comment_delete`,`comment_publish`),
KEY `user_type` (`user_id`,`target_type`),
KEY `target_parent_id` (`target_parent_id`),
KEY `comment_left` (`comment_left`),
KEY `comment_right` (`comment_right`),
KEY `comment_level` (`comment_level`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;





CREATE TABLE IF NOT EXISTS `prefix_comment_online` (
`comment_online_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`target_id` int(11) unsigned DEFAULT NULL,
`target_type` enum('topic','talk') NOT NULL DEFAULT 'topic',
`target_parent_id` int(11) NOT NULL DEFAULT '0',
`comment_id` int(11) unsigned NOT NULL,
PRIMARY KEY (`comment_online_id`),
UNIQUE KEY `id_type` (`target_id`,`target_type`),
KEY `comment_id` (`comment_id`),
KEY `type_parent` (`target_type`,`target_parent_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;





CREATE TABLE IF NOT EXISTS `prefix_favourite` (
`user_id` int(11) unsigned NOT NULL,
`target_id` int(11) unsigned DEFAULT NULL,
`target_type` enum('topic','comment','talk') DEFAULT 'topic',
`target_publish` tinyint(1) DEFAULT '1',
`tags` varchar(250) NOT NULL,
UNIQUE KEY `user_id_target_id_type` (`user_id`,`target_id`,`target_type`),
KEY `target_publish` (`target_publish`),
KEY `id_type` (`target_id`,`target_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;





CREATE TABLE IF NOT EXISTS `prefix_favourite_tag` (
`user_id` int(10) unsigned NOT NULL,
`target_id` int(11) NOT NULL,
`target_type` enum('topic','comment','talk') NOT NULL,
`is_user` tinyint(1) NOT NULL DEFAULT '0',
`text` varchar(50) NOT NULL,
KEY `user_id_target_type_id` (`user_id`,`target_type`,`target_id`),
KEY `target_type_id` (`target_type`,`target_id`),
KEY `is_user` (`is_user`),
KEY `text` (`text`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;





CREATE TABLE IF NOT EXISTS `prefix_friend` (
`user_from` int(11) unsigned NOT NULL DEFAULT '0',
`user_to` int(11) unsigned NOT NULL DEFAULT '0',
`status_from` int(4) NOT NULL,
`status_to` int(4) NOT NULL,
PRIMARY KEY (`user_from`,`user_to`),
KEY `user_to` (`user_to`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;





CREATE TABLE IF NOT EXISTS `prefix_invite` (
`invite_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`invite_code` varchar(32) NOT NULL,
`user_from_id` int(11) unsigned NOT NULL,
`user_to_id` int(11) unsigned DEFAULT NULL,
`invite_date_add` datetime NOT NULL,
`invite_date_used` datetime DEFAULT NULL,
`invite_used` tinyint(1) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`invite_id`),
UNIQUE KEY `invite_code` (`invite_code`),
KEY `user_from_id` (`user_from_id`),
KEY `user_to_id` (`user_to_id`),
KEY `invite_date_add` (`invite_date_add`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;





CREATE TABLE IF NOT EXISTS `prefix_notify_task` (
`notify_task_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`user_login` varchar(30) DEFAULT NULL,
`user_mail` varchar(50) DEFAULT NULL,
`notify_subject` varchar(200) DEFAULT NULL,
`notify_text` text,
`date_created` datetime DEFAULT NULL,
`notify_task_status` tinyint(2) unsigned DEFAULT NULL,
PRIMARY KEY (`notify_task_id`),
KEY `date_created` (`date_created`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;





CREATE TABLE IF NOT EXISTS `prefix_reminder` (
`reminder_code` varchar(32) NOT NULL,
`user_id` int(11) unsigned NOT NULL,
`reminder_date_add` datetime NOT NULL,
`reminder_date_used` datetime DEFAULT '0000-00-00 00:00:00',
`reminder_date_expire` datetime NOT NULL,
`reminde_is_used` tinyint(1) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`reminder_code`),
UNIQUE KEY `user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;





CREATE TABLE IF NOT EXISTS `prefix_session` (
`session_key` varchar(32) NOT NULL,
`user_id` int(11) unsigned NOT NULL,
`session_ip_create` varchar(15) NOT NULL,
`session_ip_last` varchar(15) NOT NULL,
`session_date_create` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`session_date_last` datetime NOT NULL,
PRIMARY KEY (`session_key`),
UNIQUE KEY `user_id` (`user_id`),
KEY `session_date_last` (`session_date_last`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;





CREATE TABLE IF NOT EXISTS `prefix_stream_event` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`event_type` varchar(100) NOT NULL,
`target_id` int(11) NOT NULL,
`user_id` int(11) unsigned NOT NULL,
`date_added` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`publish` tinyint(1) NOT NULL DEFAULT '1',
PRIMARY KEY (`id`),
KEY `event_type` (`event_type`,`user_id`),
KEY `user_id` (`user_id`),
KEY `publish` (`publish`),
KEY `target_id` (`target_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;





CREATE TABLE IF NOT EXISTS `prefix_stream_subscribe` (
`user_id` int(11) unsigned NOT NULL,
`target_user_id` int(11) NOT NULL,
KEY `user_id` (`user_id`,`target_user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;





CREATE TABLE IF NOT EXISTS `prefix_stream_user_type` (
`user_id` int(11) unsigned NOT NULL,
`event_type` varchar(100) DEFAULT NULL,
KEY `user_id` (`user_id`,`event_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;





CREATE TABLE IF NOT EXISTS `prefix_subscribe` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`target_type` varchar(20) NOT NULL,
`target_id` int(11) DEFAULT NULL,
`mail` varchar(50) NOT NULL,
`date_add` datetime NOT NULL,
`date_remove` datetime DEFAULT NULL,
`ip` varchar(20) NOT NULL,
`key` varchar(32) DEFAULT NULL,
`status` tinyint(1) NOT NULL DEFAULT '1',
PRIMARY KEY (`id`),
KEY `type` (`target_type`),
KEY `mail` (`mail`),
KEY `status` (`status`),
KEY `key` (`key`),
KEY `target_id` (`target_id`),
KEY `ip` (`ip`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;





CREATE TABLE IF NOT EXISTS `prefix_talk` (
`talk_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`user_id` int(11) unsigned NOT NULL,
`talk_title` varchar(200) NOT NULL,
`talk_text` text NOT NULL,
`talk_date` datetime NOT NULL,
`talk_date_last` datetime NOT NULL,
`talk_user_id_last` int(11) NOT NULL,
`talk_user_ip` varchar(20) NOT NULL,
`talk_comment_id_last` int(11) DEFAULT NULL,
`talk_count_comment` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`talk_id`),
KEY `user_id` (`user_id`),
KEY `talk_title` (`talk_title`),
KEY `talk_date` (`talk_date`),
KEY `talk_date_last` (`talk_date_last`),
KEY `talk_user_id_last` (`talk_user_id_last`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;





CREATE TABLE IF NOT EXISTS `prefix_talk_blacklist` (
`user_id` int(10) unsigned NOT NULL,
`user_target_id` int(10) unsigned NOT NULL,
PRIMARY KEY (`user_id`,`user_target_id`),
KEY `prefix_talk_blacklist_fk_target` (`user_target_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;





CREATE TABLE IF NOT EXISTS `prefix_talk_user` (
`talk_id` int(11) unsigned NOT NULL,
`user_id` int(11) unsigned NOT NULL,
`date_last` datetime DEFAULT NULL,
`comment_id_last` int(11) NOT NULL DEFAULT '0',
`comment_count_new` int(11) NOT NULL DEFAULT '0',
`talk_user_active` tinyint(1) DEFAULT '1',
UNIQUE KEY `talk_id_user_id` (`talk_id`,`user_id`),
KEY `user_id` (`user_id`),
KEY `date_last` (`date_last`),
KEY `date_last_2` (`date_last`),
KEY `talk_user_active` (`talk_user_active`),
KEY `comment_count_new` (`comment_count_new`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;





CREATE TABLE IF NOT EXISTS `prefix_topic` (
`topic_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`blog_id` int(11) unsigned NOT NULL,
`user_id` int(11) unsigned NOT NULL,
`topic_type` enum('topic','link','question','photoset') NOT NULL DEFAULT 'topic',
`topic_title` varchar(200) NOT NULL,
`topic_tags` varchar(250) NOT NULL COMMENT 'tags separated by a comma',
`topic_date_add` datetime NOT NULL,
`topic_date_edit` datetime DEFAULT NULL,
`topic_user_ip` varchar(20) NOT NULL,
`topic_publish` tinyint(1) NOT NULL DEFAULT '0',
`topic_publish_draft` tinyint(1) NOT NULL DEFAULT '1',
`topic_publish_index` tinyint(1) NOT NULL DEFAULT '0',
`topic_rating` float(9,3) NOT NULL DEFAULT '0.000',
`topic_count_vote` int(11) unsigned NOT NULL DEFAULT '0',
`topic_count_vote_up` int(11) NOT NULL DEFAULT '0',
`topic_count_vote_down` int(11) NOT NULL DEFAULT '0',
`topic_count_vote_abstain` int(11) NOT NULL DEFAULT '0',
`topic_count_read` int(11) unsigned NOT NULL DEFAULT '0',
`topic_count_comment` int(11) unsigned NOT NULL DEFAULT '0',
`topic_count_favourite` int(11) unsigned NOT NULL DEFAULT '0',
`topic_cut_text` varchar(100) DEFAULT NULL,
`topic_forbid_comment` tinyint(1) NOT NULL DEFAULT '0',
`topic_text_hash` varchar(32) NOT NULL,
PRIMARY KEY (`topic_id`),
KEY `blog_id` (`blog_id`),
KEY `user_id` (`user_id`),
KEY `topic_date_add` (`topic_date_add`),
KEY `topic_rating` (`topic_rating`),
KEY `topic_publish` (`topic_publish`),
KEY `topic_text_hash` (`topic_text_hash`),
KEY `topic_count_comment` (`topic_count_comment`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;





CREATE TABLE IF NOT EXISTS `prefix_topic_content` (
`topic_id` int(11) unsigned NOT NULL,
`topic_text` longtext NOT NULL,
`topic_text_short` text NOT NULL,
`topic_text_source` longtext NOT NULL,
`topic_extra` text NOT NULL,
PRIMARY KEY (`topic_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;





CREATE TABLE IF NOT EXISTS `prefix_topic_photo` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`topic_id` int(11) unsigned DEFAULT NULL,
`path` varchar(255) NOT NULL,
`description` text,
`target_tmp` varchar(40) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `topic_id` (`topic_id`),
KEY `target_tmp` (`target_tmp`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;





CREATE TABLE IF NOT EXISTS `prefix_topic_question_vote` (
`topic_id` int(11) unsigned NOT NULL,
`user_voter_id` int(11) unsigned NOT NULL,
`answer` tinyint(4) NOT NULL,
UNIQUE KEY `topic_id_user_id` (`topic_id`,`user_voter_id`),
KEY `user_voter_id` (`user_voter_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;





CREATE TABLE IF NOT EXISTS `prefix_topic_read` (
`topic_id` int(11) unsigned NOT NULL,
`user_id` int(11) unsigned NOT NULL,
`date_read` datetime NOT NULL,
`comment_count_last` int(10) unsigned NOT NULL DEFAULT '0',
`comment_id_last` int(11) NOT NULL DEFAULT '0',
UNIQUE KEY `topic_id_user_id` (`topic_id`,`user_id`),
KEY `user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;





CREATE TABLE IF NOT EXISTS `prefix_topic_tag` (
`topic_tag_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`topic_id` int(11) unsigned NOT NULL,
`user_id` int(11) unsigned NOT NULL,
`blog_id` int(11) unsigned NOT NULL,
`topic_tag_text` varchar(50) NOT NULL,
PRIMARY KEY (`topic_tag_id`),
KEY `topic_id` (`topic_id`),
KEY `user_id` (`user_id`),
KEY `blog_id` (`blog_id`),
KEY `topic_tag_text` (`topic_tag_text`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;





CREATE TABLE IF NOT EXISTS `prefix_user` (
`user_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`user_login` varchar(30) NOT NULL,
`user_password` varchar(50) NOT NULL,
`user_mail` varchar(50) NOT NULL,
`user_skill` float(9,3) unsigned NOT NULL DEFAULT '0.000',
`user_date_register` datetime NOT NULL,
`user_date_activate` datetime DEFAULT NULL,
`user_date_comment_last` datetime DEFAULT NULL,
`user_ip_register` varchar(20) NOT NULL,
`user_rating` float(9,3) NOT NULL DEFAULT '0.000',
`user_count_vote` int(11) unsigned NOT NULL DEFAULT '0',
`user_activate` tinyint(1) unsigned NOT NULL DEFAULT '0',
`user_activate_key` varchar(32) DEFAULT NULL,
`user_profile_name` varchar(50) DEFAULT NULL,
`user_profile_sex` enum('man','woman','other') NOT NULL DEFAULT 'other',
`user_profile_country` varchar(30) DEFAULT NULL,
`user_profile_region` varchar(30) DEFAULT NULL,
`user_profile_city` varchar(30) DEFAULT NULL,
`user_profile_birthday` datetime DEFAULT NULL,
`user_profile_about` text,
`user_profile_date` datetime DEFAULT NULL,
`user_profile_avatar` varchar(250) DEFAULT NULL,
`user_profile_foto` varchar(250) DEFAULT NULL,
`user_settings_notice_new_topic` tinyint(1) NOT NULL DEFAULT '1',
`user_settings_notice_new_comment` tinyint(1) NOT NULL DEFAULT '1',
`user_settings_notice_new_talk` tinyint(1) NOT NULL DEFAULT '1',
`user_settings_notice_reply_comment` tinyint(1) NOT NULL DEFAULT '1',
`user_settings_notice_new_friend` tinyint(1) NOT NULL DEFAULT '1',
`user_settings_timezone` varchar(6) DEFAULT NULL,
PRIMARY KEY (`user_id`),
UNIQUE KEY `user_login` (`user_login`),
UNIQUE KEY `user_mail` (`user_mail`),
KEY `user_activate_key` (`user_activate_key`),
KEY `user_activate` (`user_activate`),
KEY `user_rating` (`user_rating`),
KEY `user_profile_sex` (`user_profile_sex`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;


INSERT INTO `prefix_user` (`user_id`, `user_login`, `user_password`, `user_mail`, `user_skill`, `user_date_register`, `user_date_activate`, `user_date_comment_last`, `user_ip_register`, `user_rating`, `user_count_vote`, `user_activate`, `user_activate_key`, `user_profile_name`, `user_profile_sex`, `user_profile_country`, `user_profile_region`, `user_profile_city`, `user_profile_birthday`, `user_profile_about`, `user_profile_date`, `user_profile_avatar`, `user_profile_foto`, `user_settings_notice_new_topic`, `user_settings_notice_new_comment`, `user_settings_notice_new_talk`, `user_settings_notice_reply_comment`, `user_settings_notice_new_friend`, `user_settings_timezone`) VALUES
(1, 'admin', '21232f297a57a5a743894a0e4a801fc3', 'admin@admin.adm', 0.000, '2012-04-10 00:00:00', NULL, NULL, '127.0.0.1', 0.000, 0, 1, NULL, NULL, 'other', NULL, NULL, NULL, NULL, NULL, NULL, '0', NULL, 1, 1, 1, 1, 1, NULL);



CREATE TABLE IF NOT EXISTS `prefix_userfeed_subscribe` (
`user_id` int(11) unsigned NOT NULL,
`subscribe_type` tinyint(4) NOT NULL,
`target_id` int(11) NOT NULL,
KEY `user_id` (`user_id`,`subscribe_type`,`target_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;





CREATE TABLE IF NOT EXISTS `prefix_user_administrator` (
`user_id` int(11) unsigned NOT NULL,
UNIQUE KEY `user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


INSERT INTO `prefix_user_administrator` (`user_id`) VALUES
(1);



CREATE TABLE IF NOT EXISTS `prefix_user_changemail` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) unsigned NOT NULL,
`date_add` datetime NOT NULL,
`date_used` datetime DEFAULT NULL,
`date_expired` datetime NOT NULL,
`mail_from` varchar(50) NOT NULL,
`mail_to` varchar(50) NOT NULL,
`code_from` varchar(32) NOT NULL,
`code_to` varchar(32) NOT NULL,
`confirm_from` tinyint(1) NOT NULL DEFAULT '0',
`confirm_to` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`),
KEY `code_from` (`code_from`),
KEY `code_to` (`code_to`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;





CREATE TABLE IF NOT EXISTS `prefix_user_field` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`type` varchar(50) NOT NULL,
`name` varchar(255) NOT NULL,
`title` varchar(255) NOT NULL,
`pattern` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `name` (`name`),
KEY `type` (`type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=10 ;


INSERT INTO `prefix_user_field` (`id`, `type`, `name`, `title`, `pattern`) VALUES
(1, 'contact', 'phone', 'Телефон', ''),
(2, 'contact', 'mail', 'E-mail', '<a href="mailto:{*}" rel="nofollow">{*}</a>'),
(3, 'contact', 'skype', 'Skype', '<a href="skype:{*}" rel="nofollow">{*}</a>'),
(4, 'contact', 'icq', 'ICQ', '<a href="http://www.icq.com/people/about_me.php?uin={*}" rel="nofollow">{*}</a>'),
(5, 'contact', 'www', 'Сайт', '<a href="http://{*}" rel="nofollow">{*}</a>'),
(6, 'social', 'twitter', 'Twitter', '<a href="http://twitter.com/{*}/" rel="nofollow">{*}</a>'),
(7, 'social', 'facebook', 'Facebook', '<a href="http://facebook.com/{*}" rel="nofollow">{*}</a>'),
(8, 'social', 'vkontakte', 'ВКонтакте', '<a href="http://vk.com/{*}" rel="nofollow">{*}</a>'),
(9, 'social', 'odnoklassniki', 'Одноклассники', '<a href="http://www.odnoklassniki.ru/profile/{*}/" rel="nofollow">{*}</a>');



CREATE TABLE IF NOT EXISTS `prefix_user_field_value` (
`user_id` int(11) unsigned NOT NULL,
`field_id` int(11) DEFAULT NULL,
`value` varchar(255) DEFAULT NULL,
KEY `user_id` (`user_id`,`field_id`),
KEY `field_id` (`field_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;





CREATE TABLE IF NOT EXISTS `prefix_user_note` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`target_user_id` int(11) unsigned NOT NULL,
`user_id` int(11) unsigned NOT NULL,
`text` text NOT NULL,
`date_add` datetime NOT NULL,
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`),
KEY `target_user_id` (`target_user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;





CREATE TABLE IF NOT EXISTS `prefix_vote` (
`target_id` int(11) unsigned NOT NULL DEFAULT '0',
`target_type` enum('topic','blog','user','comment') NOT NULL DEFAULT 'topic',
`user_voter_id` int(11) unsigned NOT NULL,
`vote_direction` tinyint(2) DEFAULT '0',
`vote_value` float(9,3) NOT NULL DEFAULT '0.000',
`vote_date` datetime NOT NULL,
`vote_ip` varchar(15) NOT NULL DEFAULT '',
PRIMARY KEY (`target_id`,`target_type`,`user_voter_id`),
KEY `user_voter_id` (`user_voter_id`),
KEY `vote_ip` (`vote_ip`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;





CREATE TABLE IF NOT EXISTS `prefix_wall` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`pid` int(11) DEFAULT NULL,
`wall_user_id` int(11) unsigned NOT NULL,
`user_id` int(11) unsigned NOT NULL,
`count_reply` int(11) NOT NULL DEFAULT '0',
`last_reply` varchar(100) NOT NULL,
`date_add` datetime NOT NULL,
`ip` varchar(20) NOT NULL,
`text` text NOT NULL,
PRIMARY KEY (`id`),
KEY `pid` (`pid`),
KEY `wall_user_id` (`wall_user_id`),
KEY `ip` (`ip`),
KEY `user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;




ALTER TABLE `prefix_blog`
ADD CONSTRAINT `prefix_blog_fk` FOREIGN KEY (`user_owner_id`) REFERENCES `prefix_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;

ALTER TABLE `prefix_blog_user`
ADD CONSTRAINT `prefix_blog_user_fk` FOREIGN KEY (`blog_id`) REFERENCES `prefix_blog` (`blog_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `prefix_blog_user_fk1` FOREIGN KEY (`user_id`) REFERENCES `prefix_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;

ALTER TABLE `prefix_comment`
ADD CONSTRAINT `prefix_topic_comment_fk` FOREIGN KEY (`comment_pid`) REFERENCES `prefix_comment` (`comment_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `topic_comment_fk1` FOREIGN KEY (`user_id`) REFERENCES `prefix_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;

ALTER TABLE `prefix_comment_online`
ADD CONSTRAINT `prefix_topic_comment_online_fk1` FOREIGN KEY (`comment_id`) REFERENCES `prefix_comment` (`comment_id`) ON DELETE CASCADE ON UPDATE CASCADE;

ALTER TABLE `prefix_favourite`
ADD CONSTRAINT `prefix_favourite_target_fk` FOREIGN KEY (`user_id`) REFERENCES `prefix_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;

ALTER TABLE `prefix_favourite_tag`
ADD CONSTRAINT `prefix_favourite_tag_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `prefix_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;

ALTER TABLE `prefix_friend`
ADD CONSTRAINT `prefix_friend_from_fk` FOREIGN KEY (`user_from`) REFERENCES `prefix_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `prefix_friend_to_fk` FOREIGN KEY (`user_to`) REFERENCES `prefix_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;

ALTER TABLE `prefix_invite`
ADD CONSTRAINT `prefix_invite_fk` FOREIGN KEY (`user_from_id`) REFERENCES `prefix_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `prefix_invite_fk1` FOREIGN KEY (`user_to_id`) REFERENCES `prefix_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;

ALTER TABLE `prefix_reminder`
ADD CONSTRAINT `prefix_reminder_fk` FOREIGN KEY (`user_id`) REFERENCES `prefix_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;

ALTER TABLE `prefix_session`
ADD CONSTRAINT `prefix_session_fk` FOREIGN KEY (`user_id`) REFERENCES `prefix_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;

ALTER TABLE `prefix_stream_event`
ADD CONSTRAINT `prefix_stream_event_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `prefix_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;

ALTER TABLE `prefix_stream_subscribe`
ADD CONSTRAINT `prefix_stream_subscribe_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `prefix_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;

ALTER TABLE `prefix_stream_user_type`
ADD CONSTRAINT `prefix_stream_user_type_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `prefix_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;

ALTER TABLE `prefix_talk`
ADD CONSTRAINT `prefix_talk_fk` FOREIGN KEY (`user_id`) REFERENCES `prefix_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;

ALTER TABLE `prefix_talk_blacklist`
ADD CONSTRAINT `prefix_talk_blacklist_fk_target` FOREIGN KEY (`user_target_id`) REFERENCES `prefix_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `prefix_talk_blacklist_fk_user` FOREIGN KEY (`user_id`) REFERENCES `prefix_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;

ALTER TABLE `prefix_talk_user`
ADD CONSTRAINT `prefix_talk_user_fk` FOREIGN KEY (`talk_id`) REFERENCES `prefix_talk` (`talk_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `prefix_talk_user_fk1` FOREIGN KEY (`user_id`) REFERENCES `prefix_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;

ALTER TABLE `prefix_topic`
ADD CONSTRAINT `prefix_topic_fk` FOREIGN KEY (`blog_id`) REFERENCES `prefix_blog` (`blog_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `prefix_topic_fk1` FOREIGN KEY (`user_id`) REFERENCES `prefix_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;

ALTER TABLE `prefix_topic_content`
ADD CONSTRAINT `prefix_topic_content_fk` FOREIGN KEY (`topic_id`) REFERENCES `prefix_topic` (`topic_id`) ON DELETE CASCADE ON UPDATE CASCADE;

ALTER TABLE `prefix_topic_photo`
ADD CONSTRAINT `prefix_topic_photo_ibfk_1` FOREIGN KEY (`topic_id`) REFERENCES `prefix_topic` (`topic_id`) ON DELETE CASCADE ON UPDATE CASCADE;

ALTER TABLE `prefix_topic_question_vote`
ADD CONSTRAINT `prefix_topic_question_vote_fk` FOREIGN KEY (`topic_id`) REFERENCES `prefix_topic` (`topic_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `prefix_topic_question_vote_fk1` FOREIGN KEY (`user_voter_id`) REFERENCES `prefix_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;

ALTER TABLE `prefix_topic_read`
ADD CONSTRAINT `prefix_topic_read_fk` FOREIGN KEY (`topic_id`) REFERENCES `prefix_topic` (`topic_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `prefix_topic_read_fk1` FOREIGN KEY (`user_id`) REFERENCES `prefix_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;

ALTER TABLE `prefix_topic_tag`
ADD CONSTRAINT `prefix_topic_tag_fk` FOREIGN KEY (`topic_id`) REFERENCES `prefix_topic` (`topic_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `prefix_topic_tag_fk1` FOREIGN KEY (`user_id`) REFERENCES `prefix_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `prefix_topic_tag_fk2` FOREIGN KEY (`blog_id`) REFERENCES `prefix_blog` (`blog_id`) ON DELETE CASCADE ON UPDATE CASCADE;

ALTER TABLE `prefix_userfeed_subscribe`
ADD CONSTRAINT `prefix_userfeed_subscribe_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `prefix_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;

ALTER TABLE `prefix_user_administrator`
ADD CONSTRAINT `user_administrator_fk` FOREIGN KEY (`user_id`) REFERENCES `prefix_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;

ALTER TABLE `prefix_user_changemail`
ADD CONSTRAINT `prefix_user_changemail_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `prefix_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;

ALTER TABLE `prefix_user_field_value`
ADD CONSTRAINT `prefix_user_field_value_ibfk_2` FOREIGN KEY (`field_id`) REFERENCES `prefix_user_field` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `prefix_user_field_value_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `prefix_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;

ALTER TABLE `prefix_user_note`
ADD CONSTRAINT `prefix_user_note_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `prefix_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `prefix_user_note_ibfk_1` FOREIGN KEY (`target_user_id`) REFERENCES `prefix_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;

ALTER TABLE `prefix_vote`
ADD CONSTRAINT `prefix_topic_vote_fk1` FOREIGN KEY (`user_voter_id`) REFERENCES `prefix_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;

ALTER TABLE `prefix_wall`
ADD CONSTRAINT `prefix_wall_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `prefix_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `prefix_wall_ibfk_1` FOREIGN KEY (`wall_user_id`) REFERENCES `prefix_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;

+ 158
- 1
tests/AbstractFixtures.php View File

@@ -18,6 +18,8 @@ abstract class AbstractFixtures
*/
private $aReferences = array();

private $aActivePlugins = array();

/**
* @param Engine $oEngine
* @param array $aReferences
@@ -27,6 +29,7 @@ abstract class AbstractFixtures
{
$this->oEngine = $oEngine;
$this->aReferences = $aReferences;
$this->aActivePlugins = $oEngine->Plugin_GetActivePlugins();
}

/**
@@ -80,8 +83,162 @@ abstract class AbstractFixtures
*
* @return int
*/
public static function getOrder() {
public static function getOrder()
{
return 0;
}

/**
* Get Active Plugins
*
* @return Active Plugins
*/
protected function getActivePlugins()
{
return $this->aActivePlugins;
}

/**
* Create topic with default values
*
* @param int $iBlogId
* @param int $iUserId
* @param string $sTitle
* @param string $sText
* @param string $sTags
* @param string $sDate
* @param bool $bPublish
* @param bool $bPublishMain
* @param bool $bPublishDraft
*
* @throws Exception
*
* @return ModuleTopic_EntityTopic
*/
protected function _createTopic($iBlogId, $iUserId, $sTitle, $sText, $sTags, $sDate, $bPublish = true, $bPublishMain = true, $bPublishDraft = true)
{
$oTopic = Engine::GetEntity('Topic');
/* @var $oTopic ModuleTopic_EntityTopic */
$oTopic->setBlogId($iBlogId);
$oTopic->setUserId($iUserId);
$oTopic->setUserIp('127.0.0.1');
$oTopic->setForbidComment(false);
$oTopic->setType('topic');
$oTopic->setTitle($sTitle);
$oTopic->setPublish($bPublish);//
$oTopic->setPublishIndex($bPublishMain);//
$oTopic->setPublishDraft($bPublishDraft);
$oTopic->setDateAdd($sDate);
$oTopic->setTextSource($sText);
list($sTextShort, $sTextNew, $sTextCut) = $this->oEngine->Text_Cut($oTopic->getTextSource());

$oTopic->setCutText($sTextCut);
$oTopic->setText($this->oEngine->Text_Parser($sTextNew));
$oTopic->setTextShort($this->oEngine->Text_Parser($sTextShort));

$oTopic->setTextHash(md5($oTopic->getType() . $oTopic->getTextSource() . $oTopic->getTitle()));
$oTopic->setTags($sTags);
//with active plugin l10n added a field topic_lang
if (in_array('l10n', $this->getActivePlugins())) {
$oTopic->setTopicLang(Config::Get('lang.current'));
}
// @todo refact this
$oTopic->_setValidateScenario('topic');
$bValid = $oTopic->_Validate();

if (!$bValid) {
throw new Exception("Create topic - validation error");
}

$this->oEngine->Topic_AddTopic($oTopic);

return $oTopic;
}

/**
* Create user with default values
*
* @param string $sUserName
* @param string $sPassword
* @param string $sMail
* @param string $sDate
*
* @return ModuleTopic_EntityUser
*/
protected function _createUser($sUserName, $sPassword, $sMail, $sDate)
{
$oUser = Engine::GetEntity('User');
$oUser->setLogin($sUserName);
$oUser->setPassword(md5($sPassword));
$oUser->setMail($sMail);
$oUser->setUserDateRegister($sDate);
$oUser->setUserIpRegister('127.0.0.1');
$oUser->setUserActivate('1');
$oUser->setUserActivateKey('0');

$this->oEngine->User_Add($oUser);

return $oUser;
}

/**
* Create topic comment with default values
*
* @param object $oTopic
* @param object $oUser
* @param integer $iParentId
* @param string $sText
*
* @return ModuleComment_EntityComment
*/
protected function _createComment($oTopic, $oUser, $iParentId = null, $sText = 'fixture comment text')
{
$oComment = Engine::GetEntity('Comment');
$oComment->setTargetId($oTopic->getId());
$oComment->setTargetType('topic');
$oComment->setTargetParentId($oTopic->getBlogId());
$oComment->setUserId($oUser->getId());
$oComment->setText($sText);
$oComment->setDate(date('Y-m-d H:i:s', time()));
$oComment->setUserIp(func_getIp());
$oComment->setPid($iParentId);
$oComment->setTextHash(md5($sText));
$oComment->setPublish(true);

$oComment = $this->oEngine->Comment_AddComment($oComment);

return $oComment;
}

/**
* Create Blog Category
*
* @param string $sTitle
* @param string $sUrl
* @param integer $iSort
* @param integer $iPid
*
* @throws Exception
*
* @return ModuleBlog_EntityBlogCategory
*/
protected function _createCategory($sTitle, $sUrl, $iSort = 0, $iPid = null)
{
$oCategory = Engine::GetEntity('ModuleBlog_EntityBlogCategory');
$oCategory->setTitle($sTitle);
$oCategory->setUrl($sUrl);
$oCategory->setSort($iSort);
$oCategory->setPid($iPid);

if ($oCategory->_Validate()) {
$iCategoryId = $this->oEngine->Blog_AddCategory($oCategory);
$oCategory = $this->oEngine->Blog_GetCategoryById($iCategoryId);

return $oCategory;

} else {
throw new Exception("Create category - validation error");
}
}
}


+ 13
- 0
tests/LoadFixtures.php View File

@@ -83,6 +83,19 @@ class LoadFixtures
}
echo "ExportSQL DATABASE $sDbname -> install_base.sql \n";
// Load dump from geo_base.sql

if(file_exists(Config::Get('path.root.server') . '/tests/fixtures/sql/patch.sql')) {
$result = $this->oEngine->Database_ExportSQL(dirname(__FILE__) . '/fixtures/sql/patch.sql');

if (!$result['result']) {
// exception
throw new Exception("DB is not exported with file patch.sql");
return $result['errors'];
}
echo "ExportSQL DATABASE $sDbname -> patch.sql \n";
// Load dump from patch.sql
}

$result = $this->oEngine->Database_ExportSQL(dirname(__FILE__) . '/fixtures/sql/geo_base.sql');

if (!$result['result']) {


+ 4
- 15
tests/behat/features/comment.feature View File

@@ -8,9 +8,7 @@ Feature: Test Base comment functionality (!!!SELENIUM NEEDED)
Then I want to login as "admin"

Given I am on homepage
Then I follow "Sony MicroVault Mach USB 3.0 flash drive"

Then I wait "1000"
Given I am on "/blog/3.html"

Then I follow "Add comment"
And I fill in "test comment" for "comment_text"
@@ -28,19 +26,10 @@ Feature: Test Base comment functionality (!!!SELENIUM NEEDED)
| value |
| test comment |

Then I should see in element by css "content .comment-info" values:
Then I should see in element by css "content .comment-author" values:
| value |
| /profile/admin/">admin</a> |
Then I should see in element by css "content .comment-actions" values:
| value |
| Reply |
| Delete |

#create subcomment
And I follow "Reply"
Then I wait "1000"
And I fill in "test subcomment" for "comment_text"
And I press "Add"
Then I wait "1000"

Then I should see in element by css "comment_wrapper_id_2" values:
| value |
| test subcomment |

+ 59
- 0
tests/behat/features/comment.feature.incomplete View File

@@ -0,0 +1,59 @@
Feature: Test Base comment functionality (!!!SELENIUM NEEDED)
Test base functionality of Comments

@mink:selenium2
Scenario: Adding the comment

Given I am on "/login"
Then I want to login as "admin"

Given I am on homepage
Given I am on "/blog/3.html"
Then I follow "Add comment"
And I fill in "test comment" for "comment_text"
And I press "Preview"
Then I wait "2000"

Then I should see in element by css "content .comment-preview" values:
| value |
| test comment |

And I press "Add"
Then I wait "1000"

Then I should see in element by css "content .comment-content" values:
| value |
| test comment |

Then I should see in element by css "content .comment-author" values:
| value |
| /profile/admin/">admin</a> |
Then I should see in element by css "content .comment-actions" values:
| value |
| Reply |
| Delete |

@mink:selenium2
Scenario: Reply for comment
Given I am on "/login"
Then I want to login as "admin"

Then I am on "/blog/gadgets/1.html"
Then I should see "fixture comment text"

Then I should see in element by css "content .comment-wrapper .comment-actions" values:
| value |
| Reply |

And I follow "Reply"
Then I wait "1000"
And I fill in "test subcomment" for "comment_text"

#Then print last response

And I press "Add"
Then I wait "1000"

Then I should see in element by css "#comment_content_id_2" values:
| value |
| test subcomment |

+ 9
- 1
tests/fixtures/BlogFixtures.php View File

@@ -4,14 +4,21 @@ require_once(realpath((dirname(__FILE__)) . "/../AbstractFixtures.php"));

class BlogFixtures extends AbstractFixtures
{
/**
* @return int
*/
public static function getOrder()
{
return 1;
return 2;
}

/**
* Create Blog
*/
public function load()
{
$oUserFirst = $this->getReference('user-golfer');
$oCategory = $this->getReference('blog-category');

/* @var $oBlogGadgets ModuleBlog_EntityBlog */
$oBlogGadgets = Engine::GetEntity('Blog');
@@ -22,6 +29,7 @@ class BlogFixtures extends AbstractFixtures
$oBlogGadgets->setDateAdd(date("Y-m-d H:i:s")); // @todo freeze
$oBlogGadgets->setUrl('gadgets');
$oBlogGadgets->setLimitRatingTopic(0);
$oBlogGadgets->setCategoryId($oCategory->getCategoryId());

$this->oEngine->Blog_AddBlog($oBlogGadgets);



+ 24
- 0
tests/fixtures/CategoryFixtures.php View File

@@ -0,0 +1,24 @@
<?php

require_once(realpath((dirname(__FILE__)) . "/../AbstractFixtures.php"));

class CategoryFixtures extends AbstractFixtures
{
/**
* @return int
*/
public static function getOrder()
{
return 1;
}

/**
* Create Category
*/
public function load()
{
$oBlogCategory = $this->_createCategory('First category name', 'first_category_url');

$this->addReference('blog-category', $oBlogCategory);
}
}

+ 28
- 0
tests/fixtures/CommentFixtures.php View File

@@ -0,0 +1,28 @@
<?php

require_once(realpath((dirname(__FILE__)) . "/../AbstractFixtures.php"));

class CommentFixtures extends AbstractFixtures
{

/**
* @return int
*/
public static function getOrder()
{
return 4;
}

/**
* Create Comment
*/
public function load()
{
$oUserFirst = $this->getReference('user-golfer');
$oTopic = $this->getReference('topic-toshiba');

$oTopicComment = $this->_createComment($oTopic, $oUserFirst, NULL, 'fixture comment text');
$this->addReference('topic-toshiba-comment', $oTopicComment);

}
}

+ 16
- 52
tests/fixtures/TopicFixtures.php View File

@@ -4,13 +4,21 @@ require_once(realpath((dirname(__FILE__)) . "/../AbstractFixtures.php"));

class TopicFixtures extends AbstractFixtures
{

protected $aActivePlugins = array();
/**
* @return int
*/
public static function getOrder()
{
return 2;
return 3;
}

/**
* Create Topics:
* Toshiba unveils 13.3-inch AT330 Android ICS 4.0 tablet,
* iPad 3 rumored to come this March with quad-core chip and 4G LTE,
* Sony MicroVault Mach USB 3.0 flash drive,
* Draft Topic
*/
public function load()
{
$oUserFirst = $this->getReference('user-golfer');
@@ -34,55 +42,11 @@ class TopicFixtures extends AbstractFixtures
'Want more speeds and better protection for your data? The Sony MicroVault Mach flash USB 3.0 drive is what you need. It offers the USB 3.0 interface that delivers data at super high speeds of up to 5Gbps. It’s also backward compatible with USB 2.0.',
'sony, flash, gadget', '2012-10-21 2:30:40');
$this->addReference('topic-sony', $oTopicSony);
}

/**
* Create topic with default values
*
* @param int $iBlogId
* @param int $iUserId
* @param string $sTitle
* @param string $sText
* @param string $sTags
* @param string $sDate
*
* @return ModuleTopic_EntityTopic
*/
private function _createTopic($iBlogId, $iUserId, $sTitle, $sText, $sTags, $sDate)
{
$this->aActivePlugins = $this->oEngine->Plugin_GetActivePlugins();

$oTopic = Engine::GetEntity('Topic');
/* @var $oTopic ModuleTopic_EntityTopic */
$oTopic->setBlogId($iBlogId);
$oTopic->setUserId($iUserId);
$oTopic->setUserIp('127.0.0.1');
$oTopic->setForbidComment(false);
$oTopic->setType('topic');
$oTopic->setTitle($sTitle);
$oTopic->setPublish(true);
$oTopic->setPublishIndex(true);
$oTopic->setPublishDraft(true);
$oTopic->setDateAdd($sDate);
$oTopic->setTextSource($sText);
list($sTextShort, $sTextNew, $sTextCut) = $this->oEngine->Text_Cut($oTopic->getTextSource());

$oTopic->setCutText($sTextCut);
$oTopic->setText($this->oEngine->Text_Parser($sTextNew));
$oTopic->setTextShort($this->oEngine->Text_Parser($sTextShort));

$oTopic->setTextHash(md5($oTopic->getType() . $oTopic->getTextSource() . $oTopic->getTitle()));
$oTopic->setTags($sTags);
//with active plugin l10n added a field topic_lang
if (in_array('l10n', $this->aActivePlugins)) {
$oTopic->setTopicLang(Config::Get('lang.current'));
}
// @todo refact this
$oTopic->_setValidateScenario('topic');
$oTopic->_Validate();

$this->oEngine->Topic_AddTopic($oTopic);

return $oTopic;
$oTopicDraft = $this->_createTopic($oPersonalBlogGolfer->getBlogId(), $oUserFirst->getId(),
'Draft Topic',
'draft text draft text draft text draft text draft text draft text draft text',
'sony, ipad', '2012-10-21 2:40:50', false);
$this->addReference('topic-draft', $oTopicDraft);
}
}

+ 0
- 27
tests/fixtures/UserFixtures.php View File

@@ -37,31 +37,4 @@ class UserFixtures extends AbstractFixtures
$this->oEngine->User_AddFriend($friend);

}

/**
* Create user with default values
*
* @param string $sUserName
* @param string $sPassword
* @param string $sMail
* @param string $sDate
*
* @return ModuleTopic_EntityUser
*/
private function _createUser($sUserName, $sPassword,$sMail,$sDate)
{
$oUser = Engine::GetEntity('User');
$oUser->setLogin($sUserName);
$oUser->setPassword(md5($sPassword));
$oUser->setMail($sMail);
$oUser->setUserDateRegister($sDate);
$oUser->setUserIpRegister('127.0.0.1');
$oUser->setUserActivate('1');
$oUser->setUserActivateKey('0');

$this->oEngine->User_Add($oUser);

return $oUser;
}

}

+ 0
- 1
tests/fixtures/sql/geo_base.sql View File

@@ -1 +0,0 @@
../../../install/geo_base.sql

+ 0
- 1
tests/fixtures/sql/sql.sql View File

@@ -1 +0,0 @@
../../../install/sql.sql

+ 1
- 1
tests/travis/mysql_setup.sh View File

@@ -1,6 +1,6 @@
#!/bin/sh

sudo apt-get install mysql-server mysql-client
mysql -u root -e 'CREATE DATABASE social_test;'
mysql -u root -B social_test < ./tests/fixtures/sql/sql.sql
mysql -u root -B social_test < ./tests/fixtures/sql/geo_base.sql
mysql -u root -B social_test < ./tests/fixtures/sql/patch.sql

Loading…
Cancel
Save