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
48c67aba
Commit
48c67aba
authored
Feb 11, 2008
by
romanb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
ade4cd2a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
45 additions
and
10 deletions
+45
-10
TestTest.php
tests/Orm/Component/TestTest.php
+2
-2
users.php
tests/fixtures/forum/common/users.php
+1
-1
DoctrineTestInit.php
tests/lib/DoctrineTestInit.php
+20
-1
Doctrine_TestUtil.php
tests/lib/Doctrine_TestUtil.php
+9
-2
ForumAdministrator.php
tests/models/forum/ForumAdministrator.php
+9
-0
ForumUser.php
tests/models/forum/ForumUser.php
+4
-4
No files found.
tests/Orm/Component/TestTest.php
View file @
48c67aba
...
...
@@ -16,7 +16,7 @@ class Orm_Component_TestTest extends Doctrine_OrmTestCase
public
function
testFixture
()
{
$forumUsers
=
$this
->
sharedFixture
[
'connection'
]
->
query
(
"FROM Forum
_
User u"
);
$forumUsers
=
$this
->
sharedFixture
[
'connection'
]
->
query
(
"FROM ForumUser u"
);
$this
->
assertEquals
(
2
,
count
(
$forumUsers
));
$forumUsers
[
0
]
->
delete
();
unset
(
$forumUsers
[
0
]);
...
...
@@ -25,7 +25,7 @@ class Orm_Component_TestTest extends Doctrine_OrmTestCase
public
function
testFixture2
()
{
$forumUsers
=
$this
->
sharedFixture
[
'connection'
]
->
query
(
"FROM Forum
_
User u"
);
$forumUsers
=
$this
->
sharedFixture
[
'connection'
]
->
query
(
"FROM ForumUser u"
);
$this
->
assertEquals
(
2
,
count
(
$forumUsers
));
}
}
\ No newline at end of file
tests/fixtures/forum/common/users.php
View file @
48c67aba
<?php
$fixture
=
array
(
'model'
=>
'Forum
_
User'
,
'model'
=>
'ForumUser'
,
'rows'
=>
array
(
array
(
'id'
=>
1
,
...
...
tests/lib/DoctrineTestInit.php
View file @
48c67aba
...
...
@@ -10,4 +10,23 @@ require_once 'Doctrine_OrmTestSuite.php';
require_once
'Doctrine_DbalTestSuite.php'
;
require_once
'../lib/Doctrine.php'
;
spl_autoload_register
(
array
(
'Doctrine'
,
'autoload'
));
\ No newline at end of file
spl_autoload_register
(
array
(
'Doctrine'
,
'autoload'
));
$modelDir
=
dirname
(
__FILE__
)
.
DIRECTORY_SEPARATOR
.
'..'
.
DIRECTORY_SEPARATOR
.
'models'
;
Doctrine_Manager
::
getInstance
()
->
setAttribute
(
Doctrine
::
ATTR_MODEL_LOADING
,
Doctrine
::
MODEL_LOADING_CONSERVATIVE
);
Doctrine
::
loadModels
(
$modelDir
);
/*
//spl_autoload_register(array('Doctrine_TestUtil', 'autoload'));
$modelDir = dirname(__FILE__)
. DIRECTORY_SEPARATOR . '..'
. DIRECTORY_SEPARATOR . 'models'
. DIRECTORY_SEPARATOR;
set_include_path(
get_include_path()
. PATH_SEPARATOR . $modelDir . 'cms'
. PATH_SEPARATOR . $modelDir . 'ecommerce'
. PATH_SEPARATOR . $modelDir . 'forum');
*/
\ No newline at end of file
tests/lib/Doctrine_TestUtil.php
View file @
48c67aba
<?php
class
Doctrine_TestUtil
{
{
public
static
function
getConnection
()
{
if
(
isset
(
$GLOBALS
[
'db_type'
],
$GLOBALS
[
'db_username'
],
$GLOBALS
[
'db_password'
],
...
...
@@ -14,4 +13,12 @@ class Doctrine_TestUtil
}
}
public
static
function
autoloadModel
(
$className
)
{
$modelDir
=
dirname
(
__CLASS__
)
.
'/../models/'
;
$fileName
=
$modelDir
.
str_replace
(
'_'
,
DIRECTORY_SEPARATOR
,
$className
)
.
'.php'
;
if
(
file_exists
(
$fileName
))
{
require
$fileName
;
}
}
}
\ No newline at end of file
tests/models/forum/ForumAdministrator.php
0 → 100644
View file @
48c67aba
<?php
class
ForumAdministrator
extends
ForumUser
{
public
static
function
initMetadata
(
$class
)
{
$class
->
addMappedColumn
(
'foo'
,
'string'
,
50
);
}
}
\ No newline at end of file
tests/models/forum/Forum
_
User.php
→
tests/models/forum/ForumUser.php
View file @
48c67aba
<?php
class
Forum
_
User
extends
Doctrine_Record
class
ForumUser
extends
Doctrine_Record
{
public
static
function
initMetadata
(
$class
)
{
...
...
@@ -8,10 +8,10 @@ class Forum_User extends Doctrine_Record
$class
->
setInheritanceType
(
Doctrine
::
INHERITANCETYPE_JOINED
,
array
(
'discriminatorColumn'
=>
'dtype'
,
'discriminatorMap'
=>
array
(
1
=>
'Forum
_
User'
,
2
=>
'Forum
_
Administrator'
)
1
=>
'ForumUser'
,
2
=>
'ForumAdministrator'
)
));
$class
->
setSubclasses
(
array
(
'Forum
_
Administrator'
));
$class
->
setSubclasses
(
array
(
'ForumAdministrator'
));
// property mapping
$class
->
addMappedColumn
(
'id'
,
'integer'
,
4
,
array
(
...
...
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