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
e161103e
Commit
e161103e
authored
Aug 14, 2009
by
romanb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0] Added EntityRepositoryTest. Updated build file and XML Schema for mapping files.
parent
7152da32
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
143 additions
and
18 deletions
+143
-18
build.properties.dev
build.properties.dev
+1
-1
build.xml
build.xml
+8
-8
doctrine-mapping.xsd
doctrine-mapping.xsd
+59
-9
AllTests.php
tests/Doctrine/Tests/ORM/Functional/AllTests.php
+1
-0
EntityRepositoryTest.php
tests/Doctrine/Tests/ORM/Functional/EntityRepositoryTest.php
+70
-0
Doctrine.Tests.ORM.Mapping.User.dcm.xml
...s/ORM/Mapping/xml/Doctrine.Tests.ORM.Mapping.User.dcm.xml
+4
-0
No files found.
build.properties.dev
View file @
e161103e
version=2.0
version=2.0
-alpha1
build.dir=build
dist.dir=dist
report.dir=reports
\ No newline at end of file
build.xml
View file @
e161103e
...
...
@@ -4,7 +4,7 @@
Doctrine 2 build file.
-->
<project
name=
"Doctrine2"
default=
"dist-
all
"
basedir=
"."
>
<project
name=
"Doctrine2"
default=
"dist-
orm
"
basedir=
"."
>
<property
file=
"build.properties"
/>
...
...
@@ -71,8 +71,8 @@
<!--
Builds all packages, preparing them for distribution.
-->
<target
name=
"build-
all
"
depends=
"prepare, build-common, build-dbal"
>
<copy
todir=
"${build.dir}/
all
"
>
<target
name=
"build-
orm
"
depends=
"prepare, build-common, build-dbal"
>
<copy
todir=
"${build.dir}/
orm
"
>
<fileset
refid=
"shared-artifacts"
/>
<fileset
refid=
"common-sources"
/>
<fileset
refid=
"dbal-sources"
/>
...
...
@@ -104,7 +104,7 @@
Distributes the Doctrine Common package.
-->
<target
name=
"dist-common"
>
<tar
destfile=
"${dist.dir}/Doctrine
2
-common.tar.gz"
compression=
"gzip"
>
<tar
destfile=
"${dist.dir}/Doctrine
-${version}
-common.tar.gz"
compression=
"gzip"
>
<fileset
dir=
"${build.dir}/common"
>
<include
name=
"**"
/>
</fileset>
...
...
@@ -115,7 +115,7 @@
Distributes the Doctrine DBAL package.
-->
<target
name=
"dist-dbal"
>
<tar
destfile=
"${dist.dir}/Doctrine
2
-dbal.tar.gz"
compression=
"gzip"
>
<tar
destfile=
"${dist.dir}/Doctrine
-${version}
-dbal.tar.gz"
compression=
"gzip"
>
<fileset
dir=
"${build.dir}/dbal"
>
<include
name=
"**"
/>
</fileset>
...
...
@@ -126,9 +126,9 @@
DEFAULT TARGET
Tests, builds and distributes the full Doctrine package (Common+DBAL+ORM).
-->
<target
name=
"dist-
all"
depends=
"test, build-all
, dist-common, dist-dbal"
>
<tar
destfile=
"${dist.dir}/Doctrine
2-all
.tar.gz"
compression=
"gzip"
>
<fileset
dir=
"${build.dir}/
all
"
>
<target
name=
"dist-
orm"
depends=
"test, build-orm
, dist-common, dist-dbal"
>
<tar
destfile=
"${dist.dir}/Doctrine
-${version}-orm
.tar.gz"
compression=
"gzip"
>
<fileset
dir=
"${build.dir}/
orm
"
>
<include
name=
"**"
/>
</fileset>
</tar>
...
...
doctrine-mapping.xsd
View file @
e161103e
...
...
@@ -15,7 +15,8 @@
<xs:element
name=
"doctrine-mapping"
>
<xs:complexType>
<xs:sequence>
<xs:element
name=
"entity"
type=
"orm:entity"
/>
<xs:element
name=
"mapped-superclass"
type=
"orm:mapped-superclass"
minOccurs=
"0"
/>
<xs:element
name=
"entity"
type=
"orm:entity"
minOccurs=
"0"
/>
</xs:sequence>
</xs:complexType>
</xs:element>
...
...
@@ -31,9 +32,35 @@
<xs:element
name=
"cascade-refresh"
type=
"orm:emptyType"
minOccurs=
"0"
/>
</xs:sequence>
</xs:complexType>
<xs:simpleType
name=
"lifecycle-callback-type"
>
<xs:restriction
base=
"xs:token"
>
<xs:enumeration
value=
"prePersist"
/>
<xs:enumeration
value=
"postPersist"
/>
<xs:enumeration
value=
"preUpdate"
/>
<xs:enumeration
value=
"postUpdate"
/>
<xs:enumeration
value=
"preRemove"
/>
<xs:enumeration
value=
"postRemove"
/>
<xs:enumeration
value=
"postLoad"
/>
</xs:restriction>
</xs:simpleType>
<xs:complexType
name=
"lifecycle-callback"
>
<xs:attribute
name=
"type"
type=
"orm:lifecycle-callback-type"
use=
"required"
/>
<xs:attribute
name=
"method"
type=
"xs:NMTOKEN"
use=
"required"
/>
</xs:complexType>
<xs:complexType
name=
"lifecycle-callbacks"
>
<xs:sequence>
<xs:element
name=
"lifecycle-callback"
type=
"orm:lifecycle-callback"
minOccurs=
"1"
/>
</xs:sequence>
</xs:complexType>
<xs:complexType
name=
"entity"
>
<xs:sequence>
<xs:element
name=
"discriminator-column"
type=
"orm:discriminator-column"
minOccurs=
"0"
/>
<xs:element
name=
"subclasses"
type=
"xs:NMTOKENS"
minOccurs=
"0"
/>
<xs:element
name=
"lifecycle-callbacks"
type=
"orm:lifecycle-callbacks"
minOccurs=
"0"
maxOccurs=
"1"
/>
<xs:element
name=
"id"
type=
"orm:id"
/>
<xs:element
name=
"field"
type=
"orm:field"
minOccurs=
"0"
/>
<xs:element
name=
"one-to-one"
type=
"orm:one-to-one"
minOccurs=
"0"
/>
...
...
@@ -43,17 +70,15 @@
<xs:attribute
name=
"name"
type=
"xs:string"
use=
"required"
/>
<xs:attribute
name=
"table"
type=
"xs:NMTOKEN"
/>
<xs:attribute
name=
"schema"
type=
"xs:NMTOKEN"
/>
<xs:attribute
name=
"repository-class"
type=
"xs:NMTOKEN"
/>
<xs:attribute
name=
"inheritance-type"
type=
"orm:inheritance-type"
/>
<xs:attribute
name=
"discriminator-value"
type=
"xs:NMTOKEN"
/>
</xs:complexType>
<xs:complexType
name=
"mapped-superclass"
>
<xs:sequence>
<xs:element
name=
"id"
type=
"orm:id"
minOccurs=
"0"
/>
<xs:element
name=
"field"
type=
"orm:field"
minOccurs=
"0"
/>
<xs:element
name=
"one-to-many"
type=
"orm:one-to-many"
minOccurs=
"0"
/>
<xs:element
name=
"many-to-many"
type=
"orm:many-to-many"
minOccurs=
"0"
/>
</xs:sequence>
<xs:attribute
name=
"name"
type=
"xs:NMTOKEN"
use=
"required"
/>
<xs:complexType
name=
"mapped-superclass"
>
<xs:complexContent>
<xs:extension
base=
"orm:entity"
/>
</xs:complexContent>
</xs:complexType>
<xs:simpleType
name=
"inheritance-type"
>
...
...
@@ -71,6 +96,14 @@
<xs:enumeration
value=
"IDENTITY"
/>
<xs:enumeration
value=
"AUTO"
/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType
name=
"fk-action"
>
<xs:restriction
base=
"xs:token"
>
<xs:enumeration
value=
"CASCADE"
/>
<xs:enumeration
value=
"RESTRICT"
/>
<xs:enumeration
value=
"SET_NULL"
/>
</xs:restriction>
</xs:simpleType>
<xs:complexType
name=
"field"
>
...
...
@@ -78,6 +111,16 @@
<xs:attribute
name=
"type"
type=
"xs:NMTOKEN"
use=
"required"
/>
<xs:attribute
name=
"column"
type=
"xs:NMTOKEN"
/>
<xs:attribute
name=
"length"
type=
"xs:NMTOKEN"
/>
<xs:attribute
name=
"unique"
type=
"xs:boolean"
default=
"false"
/>
<xs:attribute
name=
"nullable"
type=
"xs:boolean"
default=
"false"
/>
<xs:attribute
name=
"version"
type=
"xs:boolean"
/>
</xs:complexType>
<xs:complexType
name=
"discriminator-column"
>
<xs:attribute
name=
"name"
type=
"xs:NMTOKEN"
use=
"required"
/>
<xs:attribute
name=
"type"
type=
"xs:NMTOKEN"
use=
"required"
/>
<xs:attribute
name=
"field-name"
type=
"xs:NMTOKEN"
/>
<xs:attribute
name=
"length"
type=
"xs:NMTOKEN"
/>
</xs:complexType>
<xs:complexType
name=
"generator"
>
...
...
@@ -102,6 +145,10 @@
<xs:complexType
name=
"join-column"
>
<xs:attribute
name=
"name"
type=
"xs:NMTOKEN"
use=
"required"
/>
<xs:attribute
name=
"referencedColumnName"
type=
"xs:NMTOKEN"
use=
"required"
/>
<xs:attribute
name=
"unique"
type=
"xs:boolean"
default=
"false"
/>
<xs:attribute
name=
"nullable"
type=
"xs:boolean"
default=
"true"
/>
<xs:attribute
name=
"on-delete"
type=
"orm:fk-action"
/>
<xs:attribute
name=
"on-update"
type=
"orm:fk-action"
/>
</xs:complexType>
<xs:complexType
name=
"join-columns"
>
...
...
@@ -116,6 +163,7 @@
<xs:element
name=
"inverse-join-columns"
type=
"orm:join-columns"
/>
</xs:sequence>
<xs:attribute
name=
"name"
type=
"xs:NMTOKEN"
use=
"required"
/>
<xs:attribute
name=
"schema"
type=
"xs:NMTOKEN"
/>
</xs:complexType>
<xs:complexType
name=
"many-to-many"
>
...
...
@@ -134,6 +182,7 @@
<xs:attribute
name=
"targetEntity"
type=
"xs:NMTOKEN"
use=
"required"
/>
<xs:attribute
name=
"mappedBy"
type=
"xs:NMTOKEN"
/>
<xs:attribute
name=
"field"
type=
"xs:NMTOKEN"
use=
"required"
/>
<xs:attribute
name=
"orphan-removal"
type=
"xs:boolean"
default=
"false"
/>
</xs:complexType>
<xs:complexType
name=
"one-to-one"
>
...
...
@@ -147,6 +196,7 @@
<xs:attribute
name=
"targetEntity"
type=
"xs:NMTOKEN"
use=
"required"
/>
<xs:attribute
name=
"mappedBy"
type=
"xs:NMTOKEN"
/>
<xs:attribute
name=
"field"
type=
"xs:NMTOKEN"
use=
"required"
/>
<xs:attribute
name=
"orphan-removal"
type=
"xs:boolean"
default=
"false"
/>
</xs:complexType>
</xs:schema>
\ No newline at end of file
tests/Doctrine/Tests/ORM/Functional/AllTests.php
View file @
e161103e
...
...
@@ -39,6 +39,7 @@ class AllTests
$suite
->
addTestSuite
(
'Doctrine\Tests\ORM\Functional\LifecycleCallbackTest'
);
$suite
->
addTestSuite
(
'Doctrine\Tests\ORM\Functional\StandardEntityPersisterTest'
);
$suite
->
addTestSuite
(
'Doctrine\Tests\ORM\Functional\MappedSuperclassTest'
);
$suite
->
addTestSuite
(
'Doctrine\Tests\ORM\Functional\EntityRepositoryTest'
);
$suite
->
addTest
(
Locking\AllTests
::
suite
());
...
...
tests/Doctrine/Tests/ORM/Functional/EntityRepositoryTest.php
0 → 100644
View file @
e161103e
<?php
namespace
Doctrine\Tests\ORM\Functional
;
use
Doctrine\Tests\Models\CMS\CmsUser
;
use
Doctrine\Tests\Models\CMS\CmsPhonenumber
;
require_once
__DIR__
.
'/../../TestInit.php'
;
/**
* Description of DetachedEntityTest
*
* @author robo
*/
class
EntityRepositoryTest
extends
\Doctrine\Tests\OrmFunctionalTestCase
{
protected
function
setUp
()
{
$this
->
useModelSet
(
'cms'
);
parent
::
setUp
();
}
public
function
testBasicFinders
()
{
$user
=
new
CmsUser
;
$user
->
name
=
'Roman'
;
$user
->
username
=
'romanb'
;
$user
->
status
=
'freak'
;
$this
->
_em
->
persist
(
$user
);
$user2
=
new
CmsUser
;
$user2
->
name
=
'Guilherme'
;
$user2
->
username
=
'gblanco'
;
$user2
->
status
=
'dev'
;
$this
->
_em
->
persist
(
$user2
);
$this
->
_em
->
flush
();
$user1Id
=
$user
->
getId
();
unset
(
$user
);
unset
(
$user2
);
$this
->
_em
->
clear
();
$repos
=
$this
->
_em
->
getRepository
(
'Doctrine\Tests\Models\CMS\CmsUser'
);
$user
=
$repos
->
find
(
$user1Id
);
$this
->
assertTrue
(
$user
instanceof
CmsUser
);
$this
->
assertEquals
(
'Roman'
,
$user
->
name
);
$this
->
assertEquals
(
'freak'
,
$user
->
status
);
$this
->
_em
->
clear
();
$users
=
$repos
->
findBy
(
array
(
'status'
=>
'dev'
));
$this
->
assertEquals
(
1
,
count
(
$users
));
$this
->
assertTrue
(
$users
[
0
]
instanceof
CmsUser
);
$this
->
assertEquals
(
'Guilherme'
,
$users
[
0
]
->
name
);
$this
->
assertEquals
(
'dev'
,
$users
[
0
]
->
status
);
$this
->
_em
->
clear
();
$users
=
$repos
->
findByStatus
(
'dev'
);
$this
->
assertEquals
(
1
,
count
(
$users
));
$this
->
assertTrue
(
$users
[
0
]
instanceof
CmsUser
);
$this
->
assertEquals
(
'Guilherme'
,
$users
[
0
]
->
name
);
$this
->
assertEquals
(
'dev'
,
$users
[
0
]
->
status
);
$this
->
_em
->
clear
();
$users
=
$repos
->
findAll
();
$this
->
assertEquals
(
2
,
count
(
$users
));
}
}
tests/Doctrine/Tests/ORM/Mapping/xml/Doctrine.Tests.ORM.Mapping.User.dcm.xml
View file @
e161103e
...
...
@@ -7,6 +7,10 @@
<entity
name=
"Doctrine\Tests\ORM\Mapping\User"
table=
"cms_users"
>
<lifecycle-callbacks>
<lifecycle-callback
type=
"prePersist"
method=
"onPrePersist"
/>
</lifecycle-callbacks>
<id
name=
"id"
type=
"integer"
column=
"id"
>
<generator
strategy=
"AUTO"
/>
</id>
...
...
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