Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
3c5b98f7
Commit
3c5b98f7
authored
Jun 24, 2014
by
Klimov Paul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unit test for issue #4018 added
parent
bf599b96
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
ArticleIndex.php
tests/unit/data/ar/sphinx/ArticleIndex.php
+5
-0
ActiveRelationTest.php
tests/unit/extensions/sphinx/ActiveRelationTest.php
+13
-0
No files found.
tests/unit/data/ar/sphinx/ArticleIndex.php
View file @
3c5b98f7
...
@@ -18,6 +18,11 @@ class ArticleIndex extends ActiveRecord
...
@@ -18,6 +18,11 @@ class ArticleIndex extends ActiveRecord
return
$this
->
hasOne
(
ArticleDb
::
className
(),
[
'id'
=>
'id'
]);
return
$this
->
hasOne
(
ArticleDb
::
className
(),
[
'id'
=>
'id'
]);
}
}
public
function
getSourceCompositeLink
()
{
return
$this
->
hasOne
(
ArticleDb
::
className
(),
[
'id'
=>
'id'
,
'author_id'
=>
'author_id'
]);
}
public
function
getTags
()
public
function
getTags
()
{
{
return
$this
->
hasMany
(
TagDb
::
className
(),
[
'id'
=>
'tag'
]);
return
$this
->
hasMany
(
TagDb
::
className
(),
[
'id'
=>
'tag'
]);
...
...
tests/unit/extensions/sphinx/ActiveRelationTest.php
View file @
3c5b98f7
...
@@ -42,4 +42,17 @@ class ActiveRelationTest extends SphinxTestCase
...
@@ -42,4 +42,17 @@ class ActiveRelationTest extends SphinxTestCase
$this
->
assertTrue
(
$articles
[
0
]
->
index
instanceof
ArticleIndex
);
$this
->
assertTrue
(
$articles
[
0
]
->
index
instanceof
ArticleIndex
);
$this
->
assertTrue
(
$articles
[
1
]
->
index
instanceof
ArticleIndex
);
$this
->
assertTrue
(
$articles
[
1
]
->
index
instanceof
ArticleIndex
);
}
}
/**
* @see https://github.com/yiisoft/yii2/issues/4018
*/
public
function
testFindCompositeLink
()
{
$articles
=
ArticleIndex
::
find
()
->
with
(
'sourceCompositeLink'
)
->
all
();
$this
->
assertEquals
(
2
,
count
(
$articles
));
$this
->
assertTrue
(
$articles
[
0
]
->
isRelationPopulated
(
'sourceCompositeLink'
));
$this
->
assertNotEmpty
(
$articles
[
0
]
->
sourceCompositeLink
);
$this
->
assertTrue
(
$articles
[
1
]
->
isRelationPopulated
(
'sourceCompositeLink'
));
$this
->
assertNotEmpty
(
$articles
[
1
]
->
sourceCompositeLink
);
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment