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
02cc9b2f
Commit
02cc9b2f
authored
Nov 16, 2006
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed cache constants, added portability constants
parent
7cbef3b4
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
134 additions
and
176 deletions
+134
-176
Doctrine.php
lib/Doctrine.php
+49
-65
Configurable.php
lib/Doctrine/Configurable.php
+1
-19
Db.php
lib/Doctrine/Db.php
+1
-70
Exception.php
lib/Doctrine/Db/Exception.php
+63
-9
ConfigurableTestCase.php
tests/ConfigurableTestCase.php
+5
-4
DBTestCase.php
tests/DBTestCase.php
+14
-8
run.php
tests/run.php
+1
-1
No files found.
lib/Doctrine.php
View file @
02cc9b2f
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
*
*
* @package Doctrine
* @package Doctrine
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library)
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @category Object Relational Mapping
* @category Object Relational Mapping
* @link www.phpdoctrine.com
* @link www.phpdoctrine.com
...
@@ -32,45 +33,6 @@
...
@@ -32,45 +33,6 @@
* @version $Revision$
* @version $Revision$
*/
*/
final
class
Doctrine
{
final
class
Doctrine
{
/**
* error constants
*/
const
ERR
=
-
1
;
const
ERR_SYNTAX
=
-
2
;
const
ERR_CONSTRAINT
=
-
3
;
const
ERR_NOT_FOUND
=
-
4
;
const
ERR_ALREADY_EXISTS
=
-
5
;
const
ERR_UNSUPPORTED
=
-
6
;
const
ERR_MISMATCH
=
-
7
;
const
ERR_INVALID
=
-
8
;
const
ERR_NOT_CAPABLE
=
-
9
;
const
ERR_TRUNCATED
=
-
10
;
const
ERR_INVALID_NUMBER
=
-
11
;
const
ERR_INVALID_DATE
=
-
12
;
const
ERR_DIVZERO
=
-
13
;
const
ERR_NODBSELECTED
=
-
14
;
const
ERR_CANNOT_CREATE
=
-
15
;
const
ERR_CANNOT_DELETE
=
-
16
;
const
ERR_CANNOT_DROP
=
-
17
;
const
ERR_NOSUCHTABLE
=
-
18
;
const
ERR_NOSUCHFIELD
=
-
19
;
const
ERR_NEED_MORE_DATA
=
-
20
;
const
ERR_NOT_LOCKED
=
-
21
;
const
ERR_VALUE_COUNT_ON_ROW
=
-
22
;
const
ERR_INVALID_DSN
=
-
23
;
const
ERR_CONNECT_FAILED
=
-
24
;
const
ERR_EXTENSION_NOT_FOUND
=
-
25
;
const
ERR_NOSUCHDB
=
-
26
;
const
ERR_ACCESS_VIOLATION
=
-
27
;
const
ERR_CANNOT_REPLACE
=
-
28
;
const
ERR_CONSTRAINT_NOT_NULL
=
-
29
;
const
ERR_DEADLOCK
=
-
30
;
const
ERR_CANNOT_ALTER
=
-
31
;
const
ERR_MANAGER
=
-
32
;
const
ERR_MANAGER_PARSE
=
-
33
;
const
ERR_LOADMODULE
=
-
34
;
const
ERR_INSUFFICIENT_DATA
=
-
35
;
/**
/**
* ATTRIBUTE CONSTANTS
* ATTRIBUTE CONSTANTS
*/
*/
...
@@ -83,26 +45,6 @@ final class Doctrine {
...
@@ -83,26 +45,6 @@ final class Doctrine {
* fetchmode attribute
* fetchmode attribute
*/
*/
const
ATTR_FETCHMODE
=
2
;
const
ATTR_FETCHMODE
=
2
;
/**
* cache directory attribute
*/
const
ATTR_CACHE_DIR
=
3
;
/**
* cache time to live attribute
*/
const
ATTR_CACHE_TTL
=
4
;
/**
* cache size attribute
*/
const
ATTR_CACHE_SIZE
=
5
;
/**
* cache slam defense probability
*/
const
ATTR_CACHE_SLAM
=
6
;
/**
* cache container attribute
*/
const
ATTR_CACHE
=
7
;
/**
/**
* batch size attribute
* batch size attribute
*/
*/
...
@@ -147,15 +89,11 @@ final class Doctrine {
...
@@ -147,15 +89,11 @@ final class Doctrine {
* automatic type validations attribute
* automatic type validations attribute
*/
*/
const
ATTR_AUTO_TYPE_VLD
=
20
;
const
ATTR_AUTO_TYPE_VLD
=
20
;
/**
* short aliases attribute
*/
const
ATTR_SHORT_ALIASES
=
21
;
/**
/**
* LIMIT CONSTANTS
* LIMIT CONSTANTS
*/
*/
/**
/**
* constant for row limiting
* constant for row limiting
*/
*/
...
@@ -236,7 +174,53 @@ final class Doctrine {
...
@@ -236,7 +174,53 @@ final class Doctrine {
* constant for both accessors get and set
* constant for both accessors get and set
*/
*/
const
ACCESSOR_BOTH
=
4
;
const
ACCESSOR_BOTH
=
4
;
/**
* PORTABILITY CONSTANTS
*/
/**
* Portability: turn off all portability features.
* @see Doctrine::ATTR_PORTABILITY
*/
const
PORTABILITY_NONE
=
0
;
/**
* Portability: convert names of tables and fields to case defined in the
* "field_case" option when using the query*(), fetch*() methods.
* @see Doctrine::ATTR_PORTABILITY
*/
const
PORTABILITY_FIX_CASE
=
1
;
/**
* Portability: right trim the data output by query*() and fetch*().
* @see Doctrine::ATTR_PORTABILITY
*/
const
PORTABILITY_RTRIM
=
2
;
/**
* Portability: force reporting the number of rows deleted.
* @see Doctrine::ATTR_PORTABILITY
*/
const
PORTABILITY_DELETE_COUNT
=
4
;
/**
* Portability: convert empty values to null strings in data output by
* query*() and fetch*().
* @see Doctrine::ATTR_PORTABILITY
*/
const
PORTABILITY_EMPTY_TO_NULL
=
8
;
/**
* Portability: removes database/table qualifiers from associative indexes
* @see Doctrine::ATTR_PORTABILITY
*/
const
PORTABILITY_FIX_ASSOC_FIELD_NAMES
=
16
;
/**
* Portability: turn on all portability features.
* @see Doctrine::ATTR_PORTABILITY
*/
const
PORTABILITY_ALL
=
17
;
/**
/**
* LOCKMODE CONSTANTS
* LOCKMODE CONSTANTS
...
...
lib/Doctrine/Configurable.php
View file @
02cc9b2f
...
@@ -55,24 +55,7 @@ abstract class Doctrine_Configurable {
...
@@ -55,24 +55,7 @@ abstract class Doctrine_Configurable {
if
(
$value
<
0
)
if
(
$value
<
0
)
throw
new
Doctrine_Exception
(
"Batch size should be greater than or equal to zero"
);
throw
new
Doctrine_Exception
(
"Batch size should be greater than or equal to zero"
);
break
;
break
;
case
Doctrine
::
ATTR_CACHE_DIR
:
if
(
substr
(
trim
(
$value
),
0
,
6
)
==
"%ROOT%"
)
{
$dir
=
dirname
(
__FILE__
);
$value
=
$dir
.
substr
(
$value
,
6
);
}
break
;
case
Doctrine
::
ATTR_CACHE_TTL
:
if
(
$value
<
1
)
throw
new
Doctrine_Exception
(
"Cache TimeToLive should be greater than or equal to 1"
);
break
;
case
Doctrine
::
ATTR_CACHE_SIZE
:
if
(
$value
<
1
)
throw
new
Doctrine_Exception
(
"Cache size should be greater than or equal to 1"
);
break
;
case
Doctrine
::
ATTR_CACHE_SLAM
:
if
(
$value
<
0
||
$value
>
1
)
throw
new
Doctrine_Exception
(
"Cache slam defense should be a floating point number between 0 and 1"
);
break
;
case
Doctrine
::
ATTR_FETCHMODE
:
case
Doctrine
::
ATTR_FETCHMODE
:
if
(
$value
<
0
)
if
(
$value
<
0
)
throw
new
Doctrine_Exception
(
"Unknown fetchmode. See Doctrine::FETCH_* constants."
);
throw
new
Doctrine_Exception
(
"Unknown fetchmode. See Doctrine::FETCH_* constants."
);
...
@@ -121,7 +104,6 @@ abstract class Doctrine_Configurable {
...
@@ -121,7 +104,6 @@ abstract class Doctrine_Configurable {
case
Doctrine
::
ATTR_VLD
:
case
Doctrine
::
ATTR_VLD
:
case
Doctrine
::
ATTR_AUTO_LENGTH_VLD
:
case
Doctrine
::
ATTR_AUTO_LENGTH_VLD
:
case
Doctrine
::
ATTR_AUTO_TYPE_VLD
:
case
Doctrine
::
ATTR_AUTO_TYPE_VLD
:
case
Doctrine
::
ATTR_SHORT_ALIASES
:
case
Doctrine
::
ATTR_QUERY_LIMIT
:
case
Doctrine
::
ATTR_QUERY_LIMIT
:
break
;
break
;
...
...
lib/Doctrine/Db.php
View file @
02cc9b2f
...
@@ -410,76 +410,7 @@ class Doctrine_Db implements Countable, IteratorAggregate, Doctrine_Adapter_Inte
...
@@ -410,76 +410,7 @@ class Doctrine_Db implements Countable, IteratorAggregate, Doctrine_Adapter_Inte
return
$rows
;
return
$rows
;
}
}
/**
* fetchAll
*
* @param string $statement sql query to be executed
* @param array $params prepared statement params
* @return array
*/
public
function
fetchAll
(
$statement
,
array
$params
=
array
())
{
return
$this
->
query
(
$statement
,
$params
)
->
fetchAll
(
PDO
::
FETCH_ASSOC
);
}
/**
* fetchOne
*
* @param string $statement sql query to be executed
* @param array $params prepared statement params
* @return mixed
*/
public
function
fetchOne
(
$statement
,
array
$params
=
array
())
{
return
current
(
$this
->
query
(
$statement
,
$params
)
->
fetch
(
PDO
::
FETCH_NUM
));
}
/**
* fetchRow
*
* @param string $statement sql query to be executed
* @param array $params prepared statement params
* @return array
*/
public
function
fetchRow
(
$statement
,
array
$params
=
array
())
{
return
$this
->
query
(
$statement
,
$params
)
->
fetch
(
PDO
::
FETCH_ASSOC
);
}
/**
* fetchArray
*
* @param string $statement sql query to be executed
* @param array $params prepared statement params
* @return array
*/
public
function
fetchArray
(
$statement
,
array
$params
=
array
())
{
return
$this
->
query
(
$statement
,
$params
)
->
fetch
(
PDO
::
FETCH_NUM
);
}
/**
* fetchColumn
*
* @param string $statement sql query to be executed
* @param array $params prepared statement params
* @return array
*/
public
function
fetchColumn
(
$statement
,
array
$params
=
array
())
{
return
$this
->
query
(
$statement
,
$params
)
->
fetchAll
(
PDO
::
FETCH_COLUMN
);
}
/**
* fetchAssoc
*
* @param string $statement sql query to be executed
* @param array $params prepared statement params
* @return array
*/
public
function
fetchAssoc
(
$statement
,
array
$params
=
array
())
{
return
$this
->
query
(
$statement
,
$params
)
->
fetchAll
(
PDO
::
FETCH_ASSOC
);
}
/**
* fetchBoth
*
* @param string $statement sql query to be executed
* @param array $params prepared statement params
* @return array
*/
public
function
fetchBoth
(
$statement
,
array
$params
=
array
())
{
return
$this
->
query
(
$statement
,
$params
)
->
fetchAll
(
PDO
::
FETCH_BOTH
);
}
/**
/**
* lastInsertId
* lastInsertId
*
*
...
...
lib/Doctrine/Db/Exception.php
View file @
02cc9b2f
...
@@ -21,12 +21,66 @@
...
@@ -21,12 +21,66 @@
/**
/**
* Doctrine_Db_Exception
* Doctrine_Db_Exception
*
*
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @author Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library)
* @package Doctrine
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @category Object Relational Mapping
* @package Doctrine
* @link www.phpdoctrine.com
* @category Object Relational Mapping
* @since 1.0
* @link www.phpdoctrine.com
* @version $Revision$
* @since 1.0
*/
* @version $Revision$
class
Doctrine_Db_Exception
extends
Doctrine_Exception
{
}
*/
class
Doctrine_Db_Exception
extends
Doctrine_Exception
{
/**
* @var array $errorMessages an array containing messages for portable error codes
*/
protected
static
$errorMessages
=
array
(
Doctrine_Db
::
ERR
=>
'unknown error'
,
Doctrine_Db
::
ERR_ALREADY_EXISTS
=>
'already exists'
,
Doctrine_Db
::
ERR_CANNOT_CREATE
=>
'can not create'
,
Doctrine_Db
::
ERR_CANNOT_ALTER
=>
'can not alter'
,
Doctrine_Db
::
ERR_CANNOT_REPLACE
=>
'can not replace'
,
Doctrine_Db
::
ERR_CANNOT_DELETE
=>
'can not delete'
,
Doctrine_Db
::
ERR_CANNOT_DROP
=>
'can not drop'
,
Doctrine_Db
::
ERR_CONSTRAINT
=>
'constraint violation'
,
Doctrine_Db
::
ERR_CONSTRAINT_NOT_NULL
=>
'null value violates not-null constraint'
,
Doctrine_Db
::
ERR_DIVZERO
=>
'division by zero'
,
Doctrine_Db
::
ERR_INVALID
=>
'invalid'
,
Doctrine_Db
::
ERR_INVALID_DATE
=>
'invalid date or time'
,
Doctrine_Db
::
ERR_INVALID_NUMBER
=>
'invalid number'
,
Doctrine_Db
::
ERR_MISMATCH
=>
'mismatch'
,
Doctrine_Db
::
ERR_NODBSELECTED
=>
'no database selected'
,
Doctrine_Db
::
ERR_NOSUCHFIELD
=>
'no such field'
,
Doctrine_Db
::
ERR_NOSUCHTABLE
=>
'no such table'
,
Doctrine_Db
::
ERR_NOT_CAPABLE
=>
'MDB2 backend not capable'
,
Doctrine_Db
::
ERR_NOT_FOUND
=>
'not found'
,
Doctrine_Db
::
ERR_NOT_LOCKED
=>
'not locked'
,
Doctrine_Db
::
ERR_SYNTAX
=>
'syntax error'
,
Doctrine_Db
::
ERR_UNSUPPORTED
=>
'not supported'
,
Doctrine_Db
::
ERR_VALUE_COUNT_ON_ROW
=>
'value count on row'
,
Doctrine_Db
::
ERR_INVALID_DSN
=>
'invalid DSN'
,
Doctrine_Db
::
ERR_CONNECT_FAILED
=>
'connect failed'
,
Doctrine_Db
::
ERR_NEED_MORE_DATA
=>
'insufficient data supplied'
,
Doctrine_Db
::
ERR_EXTENSION_NOT_FOUND
=>
'extension not found'
,
Doctrine_Db
::
ERR_NOSUCHDB
=>
'no such database'
,
Doctrine_Db
::
ERR_ACCESS_VIOLATION
=>
'insufficient permissions'
,
Doctrine_Db
::
ERR_LOADMODULE
=>
'error while including on demand module'
,
Doctrine_Db
::
ERR_TRUNCATED
=>
'truncated'
,
Doctrine_Db
::
ERR_DEADLOCK
=>
'deadlock detected'
,
);
/**
* Return a textual error message for a Doctrine_Db error code
*
* @param int|array integer error code,
null to get the current error code-message map,
or an array with a new error code-message map
*
* @return string error message, or false if the error code was
* not recognized
*/
public
function
errorMessage
(
$value
=
null
)
{
return
isset
(
self
::
$errorMessages
[
$value
])
?
self
::
$errorMessages
[
$value
]
:
self
::
$errorMessages
[
Doctrine_Db
::
ERR
];
}
}
tests/ConfigurableTestCase.php
View file @
02cc9b2f
...
@@ -6,16 +6,16 @@ class Doctrine_ConfigurableTestCase extends Doctrine_UnitTestCase {
...
@@ -6,16 +6,16 @@ class Doctrine_ConfigurableTestCase extends Doctrine_UnitTestCase {
public
function
prepareData
()
{
}
public
function
prepareData
()
{
}
public
function
testSetAttribute
()
{
public
function
testSetAttribute
()
{
$table
=
$this
->
connection
->
getTable
(
"User"
);
$table
=
$this
->
connection
->
getTable
(
"User"
);
/**
$this->manager->setAttribute(Doctrine::ATTR_CACHE_TTL,100);
$this->manager->setAttribute(Doctrine::ATTR_CACHE_TTL,100);
$this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_CACHE_TTL),100);
$this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_CACHE_TTL),100);
$this->manager->setAttribute(Doctrine::ATTR_CACHE_SIZE,1);
$this->manager->setAttribute(Doctrine::ATTR_CACHE_SIZE,1);
$this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_CACHE_SIZE),1);
$this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_CACHE_SIZE),1);
$this->manager->setAttribute(Doctrine::ATTR_CACHE_DIR,"%ROOT%".DIRECTORY_SEPARATOR."cache");
$this->manager->setAttribute(Doctrine::ATTR_CACHE_DIR,"%ROOT%".DIRECTORY_SEPARATOR."cache");
$this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_CACHE_DIR),$this->manager->getRoot().DIRECTORY_SEPARATOR."cache");
$this->assertEqual($this->manager->getAttribute(Doctrine::ATTR_CACHE_DIR),$this->manager->getRoot().DIRECTORY_SEPARATOR."cache");
*/
$this
->
manager
->
setAttribute
(
Doctrine
::
ATTR_FETCHMODE
,
Doctrine
::
FETCH_LAZY
);
$this
->
manager
->
setAttribute
(
Doctrine
::
ATTR_FETCHMODE
,
Doctrine
::
FETCH_LAZY
);
$this
->
assertEqual
(
$this
->
manager
->
getAttribute
(
Doctrine
::
ATTR_FETCHMODE
),
Doctrine
::
FETCH_LAZY
);
$this
->
assertEqual
(
$this
->
manager
->
getAttribute
(
Doctrine
::
ATTR_FETCHMODE
),
Doctrine
::
FETCH_LAZY
);
...
@@ -29,6 +29,7 @@ class Doctrine_ConfigurableTestCase extends Doctrine_UnitTestCase {
...
@@ -29,6 +29,7 @@ class Doctrine_ConfigurableTestCase extends Doctrine_UnitTestCase {
$this
->
assertEqual
(
$this
->
manager
->
getAttribute
(
Doctrine
::
ATTR_LOCKMODE
),
Doctrine
::
LOCK_PESSIMISTIC
);
$this
->
assertEqual
(
$this
->
manager
->
getAttribute
(
Doctrine
::
ATTR_LOCKMODE
),
Doctrine
::
LOCK_PESSIMISTIC
);
// test invalid arguments
// test invalid arguments
/**
try {
try {
$this->manager->setAttribute(Doctrine::ATTR_CACHE_TTL,-12);
$this->manager->setAttribute(Doctrine::ATTR_CACHE_TTL,-12);
} catch(Exception $e) {
} catch(Exception $e) {
...
@@ -44,7 +45,7 @@ class Doctrine_ConfigurableTestCase extends Doctrine_UnitTestCase {
...
@@ -44,7 +45,7 @@ class Doctrine_ConfigurableTestCase extends Doctrine_UnitTestCase {
} catch(Exception $e) {
} catch(Exception $e) {
$this->assertTrue($e instanceof Exception);
$this->assertTrue($e instanceof Exception);
}
}
*/
try
{
try
{
$this
->
connection
->
beginTransaction
();
$this
->
connection
->
beginTransaction
();
$this
->
manager
->
setAttribute
(
Doctrine
::
ATTR_LOCKMODE
,
Doctrine
::
LOCK_OPTIMISTIC
);
$this
->
manager
->
setAttribute
(
Doctrine
::
ATTR_LOCKMODE
,
Doctrine
::
LOCK_OPTIMISTIC
);
...
...
tests/DBTestCase.php
View file @
02cc9b2f
...
@@ -197,7 +197,7 @@ class Doctrine_Db_TestCase extends Doctrine_UnitTestCase {
...
@@ -197,7 +197,7 @@ class Doctrine_Db_TestCase extends Doctrine_UnitTestCase {
}
}
public
function
testListeningEventsWithListenerChain
()
{
public
function
testListening
Query
EventsWithListenerChain
()
{
$this
->
dbh
->
query
(
'DROP TABLE entity'
);
$this
->
dbh
->
query
(
'DROP TABLE entity'
);
$this
->
dbh
->
addListener
(
new
Doctrine_Db_TestLogger
());
$this
->
dbh
->
addListener
(
new
Doctrine_Db_TestLogger
());
...
@@ -212,10 +212,12 @@ class Doctrine_Db_TestCase extends Doctrine_UnitTestCase {
...
@@ -212,10 +212,12 @@ class Doctrine_Db_TestCase extends Doctrine_UnitTestCase {
$this
->
assertEqual
(
$listener2
->
pop
(),
'onQuery'
);
$this
->
assertEqual
(
$listener2
->
pop
(),
'onQuery'
);
$this
->
assertEqual
(
$listener2
->
pop
(),
'onPreQuery'
);
$this
->
assertEqual
(
$listener2
->
pop
(),
'onPreQuery'
);
}
public
function
testListeningPrepareEventsWithListenerChain
()
{
$stmt
=
$this
->
dbh
->
prepare
(
'INSERT INTO entity (id) VALUES(?)'
);
$stmt
=
$this
->
dbh
->
prepare
(
'INSERT INTO entity (id) VALUES(?)'
);
$listener
=
$this
->
dbh
->
getListener
()
->
get
(
0
);
$listener2
=
$this
->
dbh
->
getListener
()
->
get
(
1
);
$this
->
assertEqual
(
$listener
->
pop
(),
'onPrepare'
);
$this
->
assertEqual
(
$listener
->
pop
(),
'onPrepare'
);
$this
->
assertEqual
(
$listener
->
pop
(),
'onPrePrepare'
);
$this
->
assertEqual
(
$listener
->
pop
(),
'onPrePrepare'
);
...
@@ -226,20 +228,24 @@ class Doctrine_Db_TestCase extends Doctrine_UnitTestCase {
...
@@ -226,20 +228,24 @@ class Doctrine_Db_TestCase extends Doctrine_UnitTestCase {
$this
->
assertEqual
(
$listener
->
pop
(),
'onExecute'
);
$this
->
assertEqual
(
$listener
->
pop
(),
'onExecute'
);
$this
->
assertEqual
(
$listener
->
pop
(),
'onPreExecute'
);
$this
->
assertEqual
(
$listener
->
pop
(),
'onPreExecute'
);
$this
->
assertEqual
(
$listener2
->
pop
(),
'onExecute'
);
$this
->
assertEqual
(
$listener2
->
pop
(),
'onExecute'
);
$this
->
assertEqual
(
$listener2
->
pop
(),
'onPreExecute'
);
$this
->
assertEqual
(
$listener2
->
pop
(),
'onPreExecute'
);
}
public
function
testListeningExecEventsWithListenerChain
()
{
$this
->
dbh
->
exec
(
'DELETE FROM entity'
);
$this
->
dbh
->
exec
(
'DELETE FROM entity'
);
$listener
=
$this
->
dbh
->
getListener
()
->
get
(
0
);
$listener2
=
$this
->
dbh
->
getListener
()
->
get
(
1
);
$this
->
assertEqual
(
$listener
->
pop
(),
'onExec'
);
$this
->
assertEqual
(
$listener
->
pop
(),
'onExec'
);
$this
->
assertEqual
(
$listener
->
pop
(),
'onPreExec'
);
$this
->
assertEqual
(
$listener
->
pop
(),
'onPreExec'
);
$this
->
assertEqual
(
$listener2
->
pop
(),
'onExec'
);
$this
->
assertEqual
(
$listener2
->
pop
(),
'onExec'
);
$this
->
assertEqual
(
$listener2
->
pop
(),
'onPreExec'
);
$this
->
assertEqual
(
$listener2
->
pop
(),
'onPreExec'
);
}
public
function
testListeningTransactionEventsWithListenerChain
()
{
$this
->
dbh
->
beginTransaction
();
$this
->
dbh
->
beginTransaction
();
$listener
=
$this
->
dbh
->
getListener
()
->
get
(
0
);
$listener2
=
$this
->
dbh
->
getListener
()
->
get
(
1
);
$this
->
assertEqual
(
$listener
->
pop
(),
'onBeginTransaction'
);
$this
->
assertEqual
(
$listener
->
pop
(),
'onBeginTransaction'
);
$this
->
assertEqual
(
$listener
->
pop
(),
'onPreBeginTransaction'
);
$this
->
assertEqual
(
$listener
->
pop
(),
'onPreBeginTransaction'
);
...
...
tests/run.php
View file @
02cc9b2f
...
@@ -111,7 +111,6 @@ $test->addTestCase(new Doctrine_PessimisticLockingTestCase());
...
@@ -111,7 +111,6 @@ $test->addTestCase(new Doctrine_PessimisticLockingTestCase());
$test
->
addTestCase
(
new
Doctrine_ViewTestCase
());
$test
->
addTestCase
(
new
Doctrine_ViewTestCase
());
$test
->
addTestCase
(
new
Doctrine_Cache_Query_SqliteTestCase
());
$test
->
addTestCase
(
new
Doctrine_CustomPrimaryKeyTestCase
());
$test
->
addTestCase
(
new
Doctrine_CustomPrimaryKeyTestCase
());
...
@@ -161,6 +160,7 @@ $test->addTestCase(new Doctrine_Query_Select_TestCase());
...
@@ -161,6 +160,7 @@ $test->addTestCase(new Doctrine_Query_Select_TestCase());
//$test->addTestCase(new Doctrine_Cache_Query_SqliteTestCase());
//$test->addTestCase(new Doctrine_Cache_FileTestCase());
//$test->addTestCase(new Doctrine_Cache_FileTestCase());
//$test->addTestCase(new Doctrine_Cache_SqliteTestCase());
//$test->addTestCase(new Doctrine_Cache_SqliteTestCase());
...
...
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