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
8386d691
Commit
8386d691
authored
May 27, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
fa11260e
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
160 additions
and
64 deletions
+160
-64
NewCoreTestCase.php
tests/NewCoreTestCase.php
+48
-0
CacheTestCase.php
tests/Query/CacheTestCase.php
+4
-15
FilterTestCase.php
tests/Record/FilterTestCase.php
+35
-0
ManyToManyTestCase.php
tests/Relation/ManyToManyTestCase.php
+4
-3
ParserTestCase.php
tests/Relation/ParserTestCase.php
+2
-0
UnitTestCase.php
tests/UnitTestCase.php
+3
-1
classes.php
tests/classes.php
+5
-3
run.php
tests/run.php
+53
-32
unsolved.php
tests/unsolved.php
+6
-10
No files found.
tests/NewCoreTestCase.php
0 → 100644
View file @
8386d691
<?php
/*
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.com>.
*/
/**
* Doctrine_NewCore_TestCase
*
* @package Doctrine
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @category Object Relational Mapping
* @link www.phpdoctrine.com
* @since 1.0
* @version $Revision$
*/
class
Doctrine_NewCore_TestCase
extends
Doctrine_UnitTestCase
{
public
function
testFromParser
()
{
$q
=
new
Doctrine_Query
();
$q
->
load
(
'User u'
,
true
);
$this
->
assertEqual
(
$q
->
getQueryPart
(
'from'
),
array
(
'entity e'
));
$this
->
assertEqual
(
count
(
$q
->
getAliasMap
()),
1
);
$q
->
load
(
'u.Phonenumber p'
,
false
);
$this
->
assertEqual
(
$q
->
getQueryPart
(
'from'
),
array
(
'entity e'
,
'LEFT JOIN phonenumber p ON e.id = p.entity_id'
));
}
}
tests/Query/CacheTestCase.php
View file @
8386d691
...
...
@@ -32,24 +32,12 @@
*/
class
Doctrine_Query_Cache_TestCase
extends
Doctrine_UnitTestCase
{
public
function
testParserCacheAddsQueriesToCache
()
{
$q
=
new
Doctrine_Query
();
$cache
=
new
Doctrine_Cache_Array
();
$q
->
setOption
(
'parserCache'
,
$cache
);
$q
->
select
(
'u.name'
)
->
from
(
'User u'
);
$q
->
getQuery
();
$this
->
assertEqual
(
$cache
->
count
(),
1
);
}
public
function
testResultSetCacheAddsResultSetsIntoCache
()
{
$q
=
new
Doctrine_Query
();
$cache
=
new
Doctrine_Cache_Array
();
$q
->
set
Option
(
'resultSetCache'
,
$cache
);
$q
->
set
Cache
(
$cache
);
$q
->
select
(
'u.name'
)
->
from
(
'User u'
);
$coll
=
$q
->
execute
();
...
...
@@ -63,12 +51,12 @@ class Doctrine_Query_Cache_TestCase extends Doctrine_UnitTestCase
$this
->
assertTrue
(
$coll
instanceof
Doctrine_Collection
);
$this
->
assertEqual
(
$coll
->
count
(),
8
);
}
public
function
testResultSetCache
AddsResultSetsIntoCache2
()
public
function
testResultSetCache
SupportsQueriesWithJoins
()
{
$q
=
new
Doctrine_Query
();
$cache
=
new
Doctrine_Cache_Array
();
$q
->
set
Option
(
'resultSetCache'
,
$cache
);
$q
->
set
Cache
(
$cache
);
$q
->
select
(
'u.name'
)
->
from
(
'User u'
)
->
leftJoin
(
'u.Phonenumber p'
);
$coll
=
$q
->
execute
();
...
...
@@ -82,4 +70,5 @@ class Doctrine_Query_Cache_TestCase extends Doctrine_UnitTestCase
$this
->
assertTrue
(
$coll
instanceof
Doctrine_Collection
);
$this
->
assertEqual
(
$coll
->
count
(),
8
);
}
}
tests/Record/FilterTestCase.php
0 → 100644
View file @
8386d691
<?php
/*
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.com>.
*/
/**
* Doctrine_Record_Filter_TestCase
*
* @package Doctrine
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @category Object Relational Mapping
* @link www.phpdoctrine.com
* @since 1.0
* @version $Revision$
*/
class
Doctrine_Record_Filter_TestCase
extends
Doctrine_UnitTestCase
{
}
tests/Relation/ManyToManyTestCase.php
View file @
8386d691
...
...
@@ -122,16 +122,17 @@ class Doctrine_Relation_ManyToMany_TestCase extends Doctrine_UnitTestCase {
}
$this
->
assertEqual
(
$rel
->
getForeign
(),
'oid'
);
}
/**
public function testManyToManyRelationFetchingWithAliasesAndCustomPKs() {
$q = new Doctrine_Query();
try {
$q->from('M2MTest2 m LEFT JOIN m.RTC5');
$this->pass();
} catch(Doctrine_Exception $e) {
$this->fail();
}
try {
$q->execute();
$this->pass();
...
...
@@ -139,7 +140,7 @@ class Doctrine_Relation_ManyToMany_TestCase extends Doctrine_UnitTestCase {
$this->fail();
}
}
*/
public
function
testManyToManyRelationFetchingWithAliasesAndCustomPKs2
()
{
$q
=
new
Doctrine_Query
();
...
...
tests/Relation/ParserTestCase.php
View file @
8386d691
...
...
@@ -195,4 +195,6 @@ class Doctrine_Relation_Parser_TestCase extends Doctrine_UnitTestCase
$rel
=
$r
->
getRelation
(
'EntityReference'
);
$this
->
assertTrue
(
$rel
instanceof
Doctrine_Relation_ForeignKey
);
}
// TODO: BETTER ASSOCIATION TABLE GUESSING
}
tests/UnitTestCase.php
View file @
8386d691
...
...
@@ -231,7 +231,9 @@ class Doctrine_UnitTestCase extends UnitTestCase {
if
(
!
$this
->
init
)
{
$this
->
init
();
}
$this
->
objTable
->
clear
();
if
(
isset
(
$this
->
objTable
))
{
$this
->
objTable
->
clear
();
}
$this
->
init
=
true
;
}
...
...
tests/classes.php
View file @
8386d691
...
...
@@ -4,7 +4,9 @@ class Entity extends Doctrine_Record {
$this
->
ownsOne
(
'Email'
,
'Entity.email_id'
);
$this
->
ownsMany
(
'Phonenumber'
,
'Phonenumber.entity_id'
);
$this
->
ownsOne
(
'Account'
,
'Account.entity_id'
);
$this
->
hasMany
(
'Entity'
,
array
(
'local'
=>
'entity1'
,
'foreign'
=>
'entity2'
));
$this
->
hasMany
(
'Entity'
,
array
(
'local'
=>
'entity1'
,
'refClass'
=>
'EntityReference'
,
'foreign'
=>
'entity2'
));
}
public
function
setTableDefinition
()
{
$this
->
hasColumn
(
'id'
,
'integer'
,
20
,
'autoincrement|primary'
);
...
...
@@ -43,7 +45,7 @@ class Account extends Doctrine_Record {
class
EntityAddress
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
hasColumn
(
'
entity
_id'
,
'integer'
);
$this
->
hasColumn
(
'
user
_id'
,
'integer'
);
$this
->
hasColumn
(
'address_id'
,
'integer'
);
}
}
...
...
@@ -617,7 +619,7 @@ class ValidatorTest_Person extends Doctrine_Record {
class
ValidatorTest_FootballPlayer
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
hasColumn
(
'person_id'
,
'string'
,
255
,
'primary'
);
$this
->
hasColumn
(
'person_id'
,
'string'
,
255
);
$this
->
hasColumn
(
'team_name'
,
'string'
,
255
);
$this
->
hasColumn
(
'goals_count'
,
'integer'
,
4
);
}
...
...
tests/run.php
View file @
8386d691
...
...
@@ -60,7 +60,7 @@ $test = new GroupTest('Doctrine Framework Unit Tests');
// DATABASE ABSTRACTION tests
/**
// Connection drivers (not yet fully tested)
$test->addTestCase(new Doctrine_Connection_Pgsql_TestCase());
$test->addTestCase(new Doctrine_Connection_Oracle_TestCase());
...
...
@@ -138,7 +138,7 @@ $test->addTestCase(new Doctrine_Expression_Oracle_TestCase());
$test->addTestCase(new Doctrine_Expression_Sqlite_TestCase());
// Core
*/
$test
->
addTestCase
(
new
Doctrine_Access_TestCase
());
//$test->addTestCase(new Doctrine_Configurable_TestCase());
...
...
@@ -150,15 +150,16 @@ $test->addTestCase(new Doctrine_Table_TestCase());
$test
->
addTestCase
(
new
Doctrine_UnitOfWork_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Connection_Transaction_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Collection_TestCase
());
//
$test->addTestCase(new Doctrine_Collection_TestCase());
// Relation handling
$test
->
addTestCase
(
new
Doctrine_TreeStructure_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Relation_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Relation_Access_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Relation_ManyToMany_TestCase
());
//
$test->addTestCase(new Doctrine_Relation_Access_TestCase());
//
$test->addTestCase(new Doctrine_Relation_ManyToMany_TestCase());
$test
->
addTestCase
(
new
Doctrine_Relation_OneToOne_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Relation_Parser_TestCase
());
// Datatypes
$test
->
addTestCase
(
new
Doctrine_Enum_TestCase
());
...
...
@@ -167,9 +168,9 @@ $test->addTestCase(new Doctrine_Boolean_TestCase());
// Utility components
$test
->
addTestCase
(
new
Doctrine_PessimisticLocking_TestCase
());
//$test->addTestCase(new Doctrine_PessimisticLocking_TestCase());
$test
->
addTestCase
(
new
Doctrine_RawSql_TestCase
());
$test
->
addTestCase
(
new
Doctrine_View_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Validator_TestCase
());
...
...
@@ -185,67 +186,87 @@ $test->addTestCase(new Doctrine_Db_Profiler_TestCase());
$test
->
addTestCase
(
new
Doctrine_EventListener_TestCase
());
$test
->
addTestCase
(
new
Doctrine_EventListener_Chain_TestCase
());
// Record
$test
->
addTestCase
(
new
Doctrine_Record_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Record_State_TestCase
());
//$test->addTestCase(new Doctrine_Record_Filter_TestCase());
// Old test cases (should be removed)
$test
->
addTestCase
(
new
Doctrine_Record_Filter_TestCase
());
$test
->
addTestCase
(
new
Doctrine_SchemaTestCase
());
$test
->
addTestCase
(
new
Doctrine_BatchIterator_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_Condition_TestCase
());
$test
->
addTestCase
(
new
Doctrine_CustomPrimaryKey_TestCase
());
$test
->
addTestCase
(
new
Doctrine_CustomResultSetOrderTestCase
());
//$test->addTestCase(new Doctrine_Collection_Offset_TestCase());
// Query tests
$test
->
addTestCase
(
new
Doctrine_Query_MultiJoin_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_ReferenceModel_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_ComponentAlias_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_ShortAliases_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_Delete_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_Where_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_Limit_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_IdentifierQuoting_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_Update_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_AggregateValue_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_Select_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_Expression_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_Having_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_From_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_JoinCondition_TestCase
());
$test
->
addTestCase
(
new
Doctrine_ColumnAlias_TestCase
());
$test
->
addTestCase
(
new
Doctrine_ColumnAggregationInheritance_TestCase
());
$test
->
addTestCase
(
new
Doctrine_ColumnAlias_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_Join_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_Orderby_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Cache_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Cache_Apc_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Cache_Memcache_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Cache_Sqlite_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_Check_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_Limit_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_IdentifierQuoting_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_Update_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_Delete_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_JoinCondition_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_Join_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_Having_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_Where_TestCase
());
$test
->
addTestCase
(
new
Doctrine_RawSql_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_Orderby_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_Subquery_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_AggregateValue_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_Select_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_From_TestCase
());
$test
->
addTestCase
(
new
Doctrine_NewCore_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Tokenizer_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Collection_Snapshot_TestCase
());
// Record
$test
->
addTestCase
(
new
Doctrine_Record_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Record_State_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_Cache_TestCase
());
// Cache tests
//$test->addTestCase(new Doctrine_Cache_Query_SqliteTestCase());
//$test->addTestCase(new Doctrine_Cache_FileTestCase());
//$test->addTestCase(new Doctrine_Cache_SqliteTestCase());
//$test->addTestCase(new Doctrine_Collection_Offset_TestCase());
//$test->addTestCase(new Doctrine_BatchIterator_TestCase());
//$test->addTestCase(new Doctrine_Hydrate_TestCase());
//$test->addTestCase(new Doctrine_Cache_TestCase());
//$test->addTestCase(new Doctrine_Query_TestCase());
class
MyReporter
extends
HtmlReporter
{
public
function
paintHeader
()
{}
...
...
tests/unsolved.php
View file @
8386d691
...
...
@@ -13,7 +13,7 @@ print "<pre>";
$manager
=
Doctrine_Manager
::
getInstance
();
$dbh
=
Doctrine_Db
::
getConnection
(
'sqlite::memory:'
);
$conn
=
$manager
->
openConnection
(
$dbh
);
/**
$user = new User();
$user->name = 'zYne';
$user->Phonenumber[0]->phonenumber = '123 123';
...
...
@@ -27,16 +27,12 @@ $city->District->name = 'District 1';
if ($city->District === $city->district_id) {
print 'case 2 works\n';
}
*/
$c
=
new
Record_Country
();
$c
->
name
=
'Some country'
;
$c
->
City
[
0
]
->
name
=
'City 1'
;
$c
->
City
[
0
]
->
District
->
name
=
'District 1'
;
print
$c
->
City
[
0
]
->
District
.
"
\n
"
;
print
$c
->
City
[
0
]
->
get
(
'district_id'
)
.
"
\n
"
;
$city
=
$c
->
City
[
0
];
$city
->
name
=
'City 1'
;
$city
->
District
->
name
=
'District 1'
;
if
(
$c
->
City
[
0
]
->
get
(
'district_id'
)
==
$c
->
City
[
0
]
->
District
)
{
print
"case 3 works!
\n
"
;
}
$c
->
save
();
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