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
d58b9604
Commit
d58b9604
authored
Jun 25, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
formatting fix
parent
1273563b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
25 deletions
+46
-25
TableTestCase.php
tests/TableTestCase.php
+46
-25
No files found.
tests/TableTestCase.php
View file @
d58b9604
...
...
@@ -30,13 +30,17 @@
* @since 1.0
* @version $Revision$
*/
class
Doctrine_Table_TestCase
extends
Doctrine_UnitTestCase
{
public
function
prepareTables
()
{
$this
->
tables
[]
=
"FieldNameTest"
;
class
Doctrine_Table_TestCase
extends
Doctrine_UnitTestCase
{
public
function
prepareTables
()
{
$this
->
tables
[]
=
'FieldNameTest'
;
parent
::
prepareTables
();
}
public
function
testFieldConversion
()
{
public
function
testFieldConversion
()
{
$this
->
dbh
->
setAttribute
(
PDO
::
ATTR_CASE
,
PDO
::
CASE_UPPER
);
$t
=
new
FieldNameTest
();
...
...
@@ -73,7 +77,7 @@ class Doctrine_Table_TestCase extends Doctrine_UnitTestCase {
$this
->
connection
->
clear
();
$t
=
$this
->
connection
->
getTable
(
'FieldNameTest'
)
->
find
(
1
);
$this
->
assertEqual
(
$t
->
someColumn
,
'abc'
);
$this
->
assertEqual
(
$t
->
someEnum
,
'php'
);
$this
->
assertEqual
(
$t
->
someInt
,
1
);
...
...
@@ -83,14 +87,8 @@ class Doctrine_Table_TestCase extends Doctrine_UnitTestCase {
$this
->
dbh
->
setAttribute
(
PDO
::
ATTR_CASE
,
PDO
::
CASE_NATURAL
);
}
public
function
testBind
()
{
$table
=
$this
->
connection
->
getTable
(
"User"
);
}
public
function
testGetIdentifier
()
{
$table
=
$this
->
connection
->
getTable
(
"User"
);
}
public
function
testGetForeignKey
()
{
public
function
testGetForeignKey
()
{
$fk
=
$this
->
objTable
->
getRelation
(
"Group"
);
$this
->
assertTrue
(
$fk
instanceof
Doctrine_Relation_Association
);
$this
->
assertTrue
(
$fk
->
getTable
()
instanceof
Doctrine_Table
);
...
...
@@ -115,29 +113,42 @@ class Doctrine_Table_TestCase extends Doctrine_UnitTestCase {
}
public
function
testGetComponentName
()
{
public
function
testGetComponentName
()
{
$this
->
assertTrue
(
$this
->
objTable
->
getComponentName
()
==
"User"
);
}
public
function
testGetTableName
()
{
public
function
testGetTableName
()
{
$this
->
assertTrue
(
$this
->
objTable
->
tableName
==
"entity"
);
}
public
function
testGetConnection
()
{
public
function
testGetConnection
()
{
$this
->
assertTrue
(
$this
->
objTable
->
getConnection
()
instanceof
Doctrine_Connection
);
}
public
function
testGetData
()
{
public
function
testGetData
()
{
$this
->
assertTrue
(
$this
->
objTable
->
getData
()
==
array
());
}
public
function
testSetSequenceName
()
{
public
function
testSetSequenceName
()
{
$this
->
objTable
->
sequenceName
=
"test-seq"
;
$this
->
assertEqual
(
$this
->
objTable
->
sequenceName
,
"test-seq"
);
$this
->
objTable
->
sequenceName
=
null
;
}
public
function
testCreate
()
{
public
function
testCreate
()
{
$record
=
$this
->
objTable
->
create
();
$this
->
assertTrue
(
$record
instanceof
Doctrine_Record
);
$this
->
assertTrue
(
$record
->
state
()
==
Doctrine_Record
::
STATE_TCLEAN
);
}
public
function
testFind
()
{
public
function
testFind
()
{
$record
=
$this
->
objTable
->
find
(
4
);
$this
->
assertTrue
(
$record
instanceof
Doctrine_Record
);
...
...
@@ -169,17 +180,23 @@ class Doctrine_Table_TestCase extends Doctrine_UnitTestCase {
$this
->
assertTrue
(
false
);
}
}
public
function
testFindAll
()
{
public
function
testFindAll
()
{
$users
=
$this
->
objTable
->
findAll
();
$this
->
assertEqual
(
$users
->
count
(),
8
);
$this
->
assertTrue
(
$users
instanceof
Doctrine_Collection
);
}
public
function
testFindByDql
()
{
public
function
testFindByDql
()
{
$users
=
$this
->
objTable
->
findByDql
(
"name LIKE '%Arnold%'"
);
$this
->
assertEqual
(
$users
->
count
(),
1
);
$this
->
assertTrue
(
$users
instanceof
Doctrine_Collection
);
}
public
function
testGetProxy
()
{
public
function
testGetProxy
()
{
$user
=
$this
->
objTable
->
getProxy
(
4
);
$this
->
assertTrue
(
$user
instanceof
Doctrine_Record
);
...
...
@@ -189,12 +206,16 @@ class Doctrine_Table_TestCase extends Doctrine_UnitTestCase {
$this
->
assertTrue
(
$e
instanceOf
Doctrine_Find_Exception
);
}
}
public
function
testGetColumns
()
{
public
function
testGetColumns
()
{
$columns
=
$this
->
objTable
->
getColumns
();
$this
->
assertTrue
(
is_array
(
$columns
));
}
public
function
testApplyInheritance
()
{
public
function
testApplyInheritance
()
{
$this
->
assertEqual
(
$this
->
objTable
->
applyInheritance
(
"id = 3"
),
"id = 3 AND type = ?"
);
}
...
...
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