Browse Source

MVA added to "Sphinx" unit tests.

tags/2.0.0-beta
Paul Klimov 11 years ago
parent
commit
0868e7d3ce
  1. 5
      extensions/sphinx/Schema.php
  2. 12
      tests/unit/data/sphinx/sphinx.conf
  3. 13
      tests/unit/data/sphinx/sphinx.sql

5
extensions/sphinx/Schema.php

@ -86,9 +86,6 @@ class Schema extends \yii\db\mysql\Schema
$table->columns[$column->name] = $column;
if ($column->isPrimaryKey) {
$table->primaryKey[] = $column->name;
if ($column->autoIncrement) {
$table->sequenceName = '';
}
}
}
return true;
@ -104,9 +101,9 @@ class Schema extends \yii\db\mysql\Schema
$column = new ColumnSchema;
$column->name = $info['Field'];
$column->isPrimaryKey = ($column->name == 'id');
// Not supported :
//$column->allowNull = $info['Null'] === 'YES';
//$column->isPrimaryKey = strpos($info['Key'], 'PRI') !== false;
//$column->autoIncrement = stripos($info['Extra'], 'auto_increment') !== false;
//$column->comment = $info['Comment'];

12
tests/unit/data/sphinx/sphinx.conf

@ -1,6 +1,13 @@
# Sphinx configuration for the unit tests
#
# Minimal Sphinx configuration sample (clean, simple, functional)
#
# Setup test environment:
# - initialize test database source:
# mysql -D yii2test -u test < /path/to/yii/tests/unit/data/sphinx/sphinx.sql
# - setup test Sphinx indexes:
# indexer --config /path/to/yii/tests/unit/data/sphinx/sphinx.conf --all [--rotate]
# - run the "searchd" daemon:
# searchd --config /path/to/yii/tests/unit/data/sphinx/sphinx.conf
source yii2_test_article_src
{
@ -19,6 +26,7 @@ source yii2_test_article_src
sql_attr_uint = id
sql_attr_uint = author_id
sql_attr_timestamp = add_date
sql_attr_multi = uint tag from query; SELECT article_id AS id, tag_id AS tag FROM yii2_test_article_tag
sql_query_info = SELECT * FROM yii2_test_article WHERE id=$id
}

13
tests/unit/data/sphinx/sphinx.sql

@ -26,3 +26,16 @@ CREATE TABLE IF NOT EXISTS `yii2_test_item` (
INSERT INTO `yii2_test_item` (`id`, `name`, `description`, `category_id`, `price`) VALUES
(1, 'pencil', 'Simple pencil', 1, 2.5),
(2, 'table', 'Wooden table', 2, 100);
CREATE TABLE IF NOT EXISTS `yii2_test_article_tag` (
`article_id` int(11) NOT NULL,
`tag_id` int(11) NOT NULL,
PRIMARY KEY (`article_id`,`tag_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO `yii2_test_article_tag` (`article_id`, `tag_id`) VALUES
(1, 1),
(1, 2),
(1, 3),
(2, 3),
(2, 4);
Loading…
Cancel
Save