Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Tomáš Trávníček
doctrine-dbal
Commits
baf09de8
Commit
baf09de8
authored
Oct 13, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added some new search tests and fixed hydration tests
parent
32a4639a
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
93 additions
and
51 deletions
+93
-51
HydrateTestCase.php
tests/HydrateTestCase.php
+2
-2
QueryTestCase.php
tests/Search/QueryTestCase.php
+47
-47
SearchTestCase.php
tests/SearchTestCase.php
+44
-2
No files found.
tests/HydrateTestCase.php
View file @
baf09de8
...
...
@@ -60,7 +60,7 @@ class Doctrine_Hydrate_TestCase extends Doctrine_UnitTestCase
public
function
testHydrateHooks
()
{
$user
=
new
User
();
$user
->
getTable
()
->
addListener
(
new
HydrationListener
);
$user
->
getTable
()
->
add
Record
Listener
(
new
HydrationListener
);
$user
->
name
=
'zYne'
;
$user
->
save
();
...
...
@@ -73,7 +73,7 @@ class Doctrine_Hydrate_TestCase extends Doctrine_UnitTestCase
$this
->
assertEqual
(
$user
->
password
,
'DEFAULT PASS'
);
}
}
class
HydrationListener
extends
Doctrine_
Event
Listener
class
HydrationListener
extends
Doctrine_
Record_
Listener
{
public
function
preHydrate
(
Doctrine_Event
$event
)
{
...
...
tests/Search/QueryTestCase.php
View file @
baf09de8
This diff is collapsed.
Click to expand it.
tests/SearchTestCase.php
View file @
baf09de8
...
...
@@ -34,12 +34,13 @@ class Doctrine_Search_TestCase extends Doctrine_UnitTestCase
{
public
function
prepareTables
()
{
$this
->
tables
=
array
(
'SearchTest'
,
'SearchTestIndex'
);
$this
->
tables
=
array
(
'SearchTest'
);
parent
::
prepareTables
();
}
public
function
prepareData
()
{
}
public
function
testBuildingOfSearchRecordDefinition
()
{
$e
=
new
SearchTest
();
...
...
@@ -49,7 +50,7 @@ class Doctrine_Search_TestCase extends Doctrine_UnitTestCase
$rel
=
$e
->
getTable
()
->
getRelation
(
'SearchTestIndex'
);
$this
->
assertIdentical
(
$rel
->
getLocal
(),
'id'
);
$this
->
assertIdentical
(
$rel
->
getForeign
(),
'
searchtest_
id'
);
$this
->
assertIdentical
(
$rel
->
getForeign
(),
'id'
);
}
public
function
testSavingEntriesUpdatesIndex
()
{
...
...
@@ -116,4 +117,45 @@ class Doctrine_Search_TestCase extends Doctrine_UnitTestCase
$this
->
assertEqual
(
count
(
$array
),
0
);
}
public
function
testUpdateIndexInsertsNullValuesForBatchUpdatedEntries
()
{
$e
=
new
SearchTest
();
$tpl
=
$e
->
getTable
()
->
getTemplate
(
'Doctrine_Template_Searchable'
);
$tpl
->
getPlugin
()
->
setOption
(
'batchUpdates'
,
true
);
$e
->
title
=
'Some searchable title'
;
$e
->
content
=
'Some searchable content'
;
$e
->
save
();
$coll
=
Doctrine_Query
::
create
()
->
from
(
'SearchTestIndex s'
)
->
orderby
(
's.id DESC'
)
->
limit
(
1
)
->
setHydrationMode
(
Doctrine
::
HYDRATE_ARRAY
)
->
fetchOne
();
$this
->
assertEqual
(
$coll
[
'id'
],
2
);
$this
->
assertEqual
(
$coll
[
'keyword'
],
null
);
$this
->
assertEqual
(
$coll
[
'field'
],
null
);
$this
->
assertEqual
(
$coll
[
'position'
],
null
);
}
public
function
testBatchUpdatesUpdateAllPendingEntries
()
{
$e
=
new
SearchTest
();
$tpl
=
$e
->
getTable
()
->
getTemplate
(
'Doctrine_Template_Searchable'
);
$tpl
->
getPlugin
()
->
processPending
();
$coll
=
Doctrine_Query
::
create
()
->
from
(
'SearchTestIndex s'
)
->
setHydrationMode
(
Doctrine
::
HYDRATE_ARRAY
)
->
execute
();
$coll
=
$this
->
conn
->
fetchAll
(
'SELECT * FROM search_test_index'
);
}
}
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