Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
laravel-mongodb
Project
Project
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
sinan
laravel-mongodb
Commits
e5cba0a9
Commit
e5cba0a9
authored
Apr 04, 2014
by
Jens Segers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding test for MorpOne
parent
ab64c586
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
RelationsTest.php
tests/RelationsTest.php
+6
-6
Client.php
tests/models/Client.php
+2
-2
No files found.
tests/RelationsTest.php
View file @
e5cba0a9
...
@@ -275,15 +275,15 @@ class RelationsTest extends TestCase {
...
@@ -275,15 +275,15 @@ class RelationsTest extends TestCase {
$this
->
assertEquals
(
1
,
$user
->
photos
->
count
());
$this
->
assertEquals
(
1
,
$user
->
photos
->
count
());
$this
->
assertEquals
(
$photo
->
id
,
$user
->
photos
->
first
()
->
id
);
$this
->
assertEquals
(
$photo
->
id
,
$user
->
photos
->
first
()
->
id
);
$photo
=
Photo
::
create
(
array
(
'url'
=>
'http://graph.facebook.com/j
ohn
.doe/picture'
));
$photo
=
Photo
::
create
(
array
(
'url'
=>
'http://graph.facebook.com/j
ane
.doe/picture'
));
$client
->
photo
s
()
->
save
(
$photo
);
$client
->
photo
()
->
save
(
$photo
);
$this
->
assert
Equals
(
1
,
$client
->
photos
->
count
()
);
$this
->
assert
NotNull
(
$client
->
photo
);
$this
->
assertEquals
(
$photo
->
id
,
$client
->
photo
s
->
first
()
->
id
);
$this
->
assertEquals
(
$photo
->
id
,
$client
->
photo
->
id
);
$client
=
Client
::
find
(
$client
->
_id
);
$client
=
Client
::
find
(
$client
->
_id
);
$this
->
assert
Equals
(
1
,
$client
->
photos
->
count
()
);
$this
->
assert
NotNull
(
$client
->
photo
);
$this
->
assertEquals
(
$photo
->
id
,
$client
->
photo
s
->
first
()
->
id
);
$this
->
assertEquals
(
$photo
->
id
,
$client
->
photo
->
id
);
$photo
=
Photo
::
first
();
$photo
=
Photo
::
first
();
$this
->
assertEquals
(
$photo
->
imageable
->
name
,
$user
->
name
);
$this
->
assertEquals
(
$photo
->
imageable
->
name
,
$user
->
name
);
...
...
tests/models/Client.php
View file @
e5cba0a9
...
@@ -12,8 +12,8 @@ class Client extends Eloquent {
...
@@ -12,8 +12,8 @@ class Client extends Eloquent {
return
$this
->
belongsToMany
(
'User'
);
return
$this
->
belongsToMany
(
'User'
);
}
}
public
function
photo
s
()
public
function
photo
()
{
{
return
$this
->
morph
Many
(
'Photo'
,
'imageable'
);
return
$this
->
morph
One
(
'Photo'
,
'imageable'
);
}
}
}
}
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