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
af385858
Commit
af385858
authored
Jan 17, 2014
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed tests for elasticsearch, mongo, redis
parent
ed97632f
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
70 additions
and
11 deletions
+70
-11
Customer.php
tests/unit/data/ar/elasticsearch/Customer.php
+6
-4
CustomerQuery.php
tests/unit/data/ar/elasticsearch/CustomerQuery.php
+17
-0
CustomerFile.php
tests/unit/data/ar/mongodb/file/CustomerFile.php
+6
-2
CustomerFileQuery.php
tests/unit/data/ar/mongodb/file/CustomerFileQuery.php
+17
-0
Customer.php
tests/unit/data/ar/redis/Customer.php
+7
-5
CustomerQuery.php
tests/unit/data/ar/redis/CustomerQuery.php
+17
-0
No files found.
tests/unit/data/ar/elasticsearch/Customer.php
View file @
af385858
...
@@ -35,10 +35,7 @@ class Customer extends ActiveRecord
...
@@ -35,10 +35,7 @@ class Customer extends ActiveRecord
return
$this
->
hasMany
(
Order
::
className
(),
array
(
'customer_id'
=>
'id'
))
->
orderBy
(
'create_time'
);
return
$this
->
hasMany
(
Order
::
className
(),
array
(
'customer_id'
=>
'id'
))
->
orderBy
(
'create_time'
);
}
}
public
static
function
active
(
$query
)
{
$query
->
andWhere
(
array
(
'status'
=>
1
));
}
public
function
afterSave
(
$insert
)
public
function
afterSave
(
$insert
)
{
{
...
@@ -67,4 +64,9 @@ class Customer extends ActiveRecord
...
@@ -67,4 +64,9 @@ class Customer extends ActiveRecord
]);
]);
}
}
public
static
function
createQuery
()
{
return
new
CustomerQuery
([
'modelClass'
=>
get_called_class
()]);
}
}
}
tests/unit/data/ar/elasticsearch/CustomerQuery.php
0 → 100644
View file @
af385858
<?php
namespace
yiiunit\data\ar\elasticsearch
;
use
yii\elasticsearch\ActiveQuery
;
/**
* CustomerQuery
*/
class
CustomerQuery
extends
ActiveQuery
{
public
function
active
()
{
$this
->
andWhere
(
array
(
'status'
=>
1
));
return
$this
;
}
}
\ No newline at end of file
tests/unit/data/ar/mongodb/file/CustomerFile.php
View file @
af385858
...
@@ -2,6 +2,9 @@
...
@@ -2,6 +2,9 @@
namespace
yiiunit\data\ar\mongodb\file
;
namespace
yiiunit\data\ar\mongodb\file
;
use
yii\mongodb\file\ActiveQuery
;
use
yiiunit\data\ar\redis\CustomerQuery
;
class
CustomerFile
extends
ActiveRecord
class
CustomerFile
extends
ActiveRecord
{
{
public
static
function
collectionName
()
public
static
function
collectionName
()
...
@@ -20,8 +23,8 @@ class CustomerFile extends ActiveRecord
...
@@ -20,8 +23,8 @@ class CustomerFile extends ActiveRecord
);
);
}
}
public
static
function
activeOnly
(
$query
)
public
static
function
createQuery
(
)
{
{
$query
->
andWhere
([
'status'
=>
2
]);
return
new
CustomerQuery
([
'modelClass'
=>
get_called_class
()
]);
}
}
}
}
\ No newline at end of file
tests/unit/data/ar/mongodb/file/CustomerFileQuery.php
0 → 100644
View file @
af385858
<?php
namespace
yiiunit\data\ar\mongodb\file
;
use
yii\mongodb\file\ActiveQuery
;
/**
* CustomerFileQuery
*/
class
CustomerFileQuery
extends
ActiveQuery
{
public
function
activeOnly
()
{
$this
->
andWhere
([
'status'
=>
2
]);
return
$this
;
}
}
\ No newline at end of file
tests/unit/data/ar/redis/Customer.php
View file @
af385858
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
namespace
yiiunit\data\ar\redis
;
namespace
yiiunit\data\ar\redis
;
use
yii\redis\ActiveQuery
;
use
yiiunit\extensions\redis\ActiveRecordTest
;
use
yiiunit\extensions\redis\ActiveRecordTest
;
class
Customer
extends
ActiveRecord
class
Customer
extends
ActiveRecord
...
@@ -24,15 +25,15 @@ class Customer extends ActiveRecord
...
@@ -24,15 +25,15 @@ class Customer extends ActiveRecord
return
$this
->
hasMany
(
Order
::
className
(),
[
'customer_id'
=>
'id'
]);
return
$this
->
hasMany
(
Order
::
className
(),
[
'customer_id'
=>
'id'
]);
}
}
public
static
function
active
(
$query
)
{
$query
->
andWhere
([
'status'
=>
1
]);
}
public
function
afterSave
(
$insert
)
public
function
afterSave
(
$insert
)
{
{
ActiveRecordTest
::
$afterSaveInsert
=
$insert
;
ActiveRecordTest
::
$afterSaveInsert
=
$insert
;
ActiveRecordTest
::
$afterSaveNewRecord
=
$this
->
isNewRecord
;
ActiveRecordTest
::
$afterSaveNewRecord
=
$this
->
isNewRecord
;
parent
::
afterSave
(
$insert
);
parent
::
afterSave
(
$insert
);
}
}
public
static
function
createQuery
()
{
return
new
CustomerQuery
([
'modelClass'
=>
get_called_class
()]);
}
}
}
\ No newline at end of file
tests/unit/data/ar/redis/CustomerQuery.php
0 → 100644
View file @
af385858
<?php
namespace
yiiunit\data\ar\redis
;
use
yii\redis\ActiveQuery
;
/**
* CustomerQuery
*/
class
CustomerQuery
extends
ActiveQuery
{
public
function
active
()
{
$this
->
andWhere
([
'status'
=>
1
]);
return
$this
;
}
}
\ No newline at end of file
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