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
a4e928e1
Commit
a4e928e1
authored
May 28, 2009
by
romanb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0] Moved addendum library to vendor dir.
parent
292e93de
Changes
15
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
1144 additions
and
376 deletions
+1144
-376
EventArgs.php
lib/Doctrine/Common/EventArgs.php
+0
-1
AnnotationDriver.php
lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php
+3
-3
DoctrineAnnotations.php
lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php
+21
-21
annotations.php
lib/Doctrine/ORM/Mapping/Driver/addendum/annotations.php
+0
-341
LICENSE
lib/vendor/addendum/LICENSE
+0
-0
annotations.php
lib/vendor/addendum/annotations.php
+341
-0
annotation_parser.php
lib/vendor/addendum/annotations/annotation_parser.php
+2
-4
doc_comment.php
lib/vendor/addendum/annotations/doc_comment.php
+0
-0
acceptance_test.php
lib/vendor/addendum/annotations/tests/acceptance_test.php
+233
-0
all_tests.php
lib/vendor/addendum/annotations/tests/all_tests.php
+33
-0
annotation_parser_test.php
...dor/addendum/annotations/tests/annotation_parser_test.php
+312
-0
annotation_test.php
lib/vendor/addendum/annotations/tests/annotation_test.php
+27
-0
constrained_annotation_test.php
...ddendum/annotations/tests/constrained_annotation_test.php
+73
-0
doc_comment_test.php
lib/vendor/addendum/annotations/tests/doc_comment_test.php
+87
-0
SingleTableInheritanceTest.php
...trine/Tests/ORM/Functional/SingleTableInheritanceTest.php
+12
-6
No files found.
lib/Doctrine/Common/EventArgs.php
View file @
a4e928e1
...
@@ -28,7 +28,6 @@ namespace Doctrine\Common;
...
@@ -28,7 +28,6 @@ namespace Doctrine\Common;
* information to an event handler when an event is raised. The single empty EventArgs
* information to an event handler when an event is raised. The single empty EventArgs
* instance can be obtained through {@link getEmptyInstance()}.
* instance can be obtained through {@link getEmptyInstance()}.
*
*
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Roman Borschel
* @author Roman Borschel
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @link www.doctrine-project.org
...
...
lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php
View file @
a4e928e1
...
@@ -26,8 +26,8 @@ use Doctrine\ORM\Mapping\ClassMetadata;
...
@@ -26,8 +26,8 @@ use Doctrine\ORM\Mapping\ClassMetadata;
use
Doctrine\ORM\Mapping\MappingException
;
use
Doctrine\ORM\Mapping\MappingException
;
/* Addendum annotation reflection extensions */
/* Addendum annotation reflection extensions */
if
(
!
class_exists
(
'
\
Addendum'
,
false
))
{
if
(
!
class_exists
(
'Addendum'
,
false
))
{
require
__DIR__
.
'/addendum/annotations.php'
;
require
__DIR__
.
'/
../../../../vendor/
addendum/annotations.php'
;
}
}
require
__DIR__
.
'/DoctrineAnnotations.php'
;
require
__DIR__
.
'/DoctrineAnnotations.php'
;
...
@@ -45,7 +45,7 @@ class AnnotationDriver
...
@@ -45,7 +45,7 @@ class AnnotationDriver
*/
*/
public
function
loadMetadataForClass
(
$className
,
ClassMetadata
$metadata
)
public
function
loadMetadataForClass
(
$className
,
ClassMetadata
$metadata
)
{
{
$annotClass
=
new
\
Addendum\
ReflectionAnnotatedClass
(
$className
);
$annotClass
=
new
\ReflectionAnnotatedClass
(
$className
);
// Evaluate DoctrineEntity annotation
// Evaluate DoctrineEntity annotation
if
((
$entityAnnot
=
$annotClass
->
getAnnotation
(
'DoctrineEntity'
))
===
false
)
{
if
((
$entityAnnot
=
$annotClass
->
getAnnotation
(
'DoctrineEntity'
))
===
false
)
{
...
...
lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php
View file @
a4e928e1
...
@@ -21,25 +21,25 @@
...
@@ -21,25 +21,25 @@
/* Annotations */
/* Annotations */
final
class
DoctrineEntity
extends
\A
ddendum\A
nnotation
{
final
class
DoctrineEntity
extends
\Annotation
{
public
$repositoryClass
;
public
$repositoryClass
;
}
}
final
class
DoctrineInheritanceType
extends
\A
ddendum\A
nnotation
{}
final
class
DoctrineInheritanceType
extends
\Annotation
{}
final
class
DoctrineDiscriminatorColumn
extends
\A
ddendum\A
nnotation
{
final
class
DoctrineDiscriminatorColumn
extends
\Annotation
{
public
$name
;
public
$name
;
public
$type
;
public
$type
;
public
$length
;
public
$length
;
}
}
final
class
DoctrineDiscriminatorMap
extends
\A
ddendum\A
nnotation
{}
final
class
DoctrineDiscriminatorMap
extends
\Annotation
{}
final
class
DoctrineDiscriminatorValue
extends
\A
ddendum\A
nnotation
{}
final
class
DoctrineDiscriminatorValue
extends
\Annotation
{}
final
class
DoctrineSubClasses
extends
\A
ddendum\A
nnotation
{}
final
class
DoctrineSubClasses
extends
\Annotation
{}
final
class
DoctrineId
extends
\A
ddendum\A
nnotation
{}
final
class
DoctrineId
extends
\Annotation
{}
final
class
DoctrineGeneratedValue
extends
\A
ddendum\A
nnotation
{
final
class
DoctrineGeneratedValue
extends
\Annotation
{
public
$strategy
;
public
$strategy
;
//public $generator;
//public $generator;
}
}
final
class
DoctrineVersion
extends
\A
ddendum\A
nnotation
{}
final
class
DoctrineVersion
extends
\Annotation
{}
final
class
DoctrineJoinColumn
extends
\A
ddendum\A
nnotation
{
final
class
DoctrineJoinColumn
extends
\Annotation
{
public
$name
;
public
$name
;
public
$referencedColumnName
;
public
$referencedColumnName
;
public
$unique
=
false
;
public
$unique
=
false
;
...
@@ -47,55 +47,55 @@ final class DoctrineJoinColumn extends \Addendum\Annotation {
...
@@ -47,55 +47,55 @@ final class DoctrineJoinColumn extends \Addendum\Annotation {
public
$onDelete
;
public
$onDelete
;
public
$onUpdate
;
public
$onUpdate
;
}
}
final
class
DoctrineJoinColumns
extends
\A
ddendum\A
nnotation
{}
final
class
DoctrineJoinColumns
extends
\Annotation
{}
final
class
DoctrineColumn
extends
\A
ddendum\A
nnotation
{
final
class
DoctrineColumn
extends
\Annotation
{
public
$type
;
public
$type
;
public
$length
;
public
$length
;
public
$unique
=
false
;
public
$unique
=
false
;
public
$nullable
=
false
;
public
$nullable
=
false
;
public
$quote
=
false
;
public
$quote
=
false
;
}
}
final
class
DoctrineOneToOne
extends
\A
ddendum\A
nnotation
{
final
class
DoctrineOneToOne
extends
\Annotation
{
public
$targetEntity
;
public
$targetEntity
;
public
$mappedBy
;
public
$mappedBy
;
public
$cascade
;
public
$cascade
;
public
$fetch
;
public
$fetch
;
public
$optional
;
public
$optional
;
}
}
final
class
DoctrineOneToMany
extends
\A
ddendum\A
nnotation
{
final
class
DoctrineOneToMany
extends
\Annotation
{
public
$mappedBy
;
public
$mappedBy
;
public
$targetEntity
;
public
$targetEntity
;
public
$cascade
;
public
$cascade
;
public
$fetch
;
public
$fetch
;
}
}
final
class
DoctrineManyToOne
extends
\A
ddendum\A
nnotation
{
final
class
DoctrineManyToOne
extends
\Annotation
{
public
$targetEntity
;
public
$targetEntity
;
public
$cascade
;
public
$cascade
;
public
$fetch
;
public
$fetch
;
public
$optional
;
public
$optional
;
}
}
final
class
DoctrineManyToMany
extends
\A
ddendum\A
nnotation
{
final
class
DoctrineManyToMany
extends
\Annotation
{
public
$targetEntity
;
public
$targetEntity
;
public
$mappedBy
;
public
$mappedBy
;
public
$cascade
;
public
$cascade
;
public
$fetch
;
public
$fetch
;
}
}
final
class
DoctrineElementCollection
extends
\A
ddendum\A
nnotation
{
final
class
DoctrineElementCollection
extends
\Annotation
{
public
$tableName
;
public
$tableName
;
}
}
final
class
DoctrineTable
extends
\A
ddendum\A
nnotation
{
final
class
DoctrineTable
extends
\Annotation
{
public
$name
;
public
$name
;
public
$catalog
;
public
$catalog
;
public
$schema
;
public
$schema
;
}
}
final
class
DoctrineJoinTable
extends
\A
ddendum\A
nnotation
{
final
class
DoctrineJoinTable
extends
\Annotation
{
public
$name
;
public
$name
;
public
$catalog
;
public
$catalog
;
public
$schema
;
public
$schema
;
public
$joinColumns
;
public
$joinColumns
;
public
$inverseJoinColumns
;
public
$inverseJoinColumns
;
}
}
final
class
DoctrineSequenceGenerator
extends
\A
ddendum\A
nnotation
{
final
class
DoctrineSequenceGenerator
extends
\Annotation
{
//public $name;
//public $name;
public
$sequenceName
;
public
$sequenceName
;
public
$allocationSize
=
20
;
public
$allocationSize
=
20
;
...
@@ -103,4 +103,4 @@ final class DoctrineSequenceGenerator extends \Addendum\Annotation {
...
@@ -103,4 +103,4 @@ final class DoctrineSequenceGenerator extends \Addendum\Annotation {
/** The name of the class that defines the generator. */
/** The name of the class that defines the generator. */
//public $definingClass;
//public $definingClass;
}
}
final
class
DoctrineChangeTrackingPolicy
{}
final
class
DoctrineChangeTrackingPolicy
extends
\Annotation
{}
lib/Doctrine/ORM/Mapping/Driver/addendum/annotations.php
deleted
100755 → 0
View file @
292e93de
This diff is collapsed.
Click to expand it.
lib/
Doctrine/ORM/Mapping/Drive
r/addendum/LICENSE
→
lib/
vendo
r/addendum/LICENSE
View file @
a4e928e1
File moved
lib/vendor/addendum/annotations.php
0 → 100755
View file @
a4e928e1
This diff is collapsed.
Click to expand it.
lib/
Doctrine/ORM/Mapping/Drive
r/addendum/annotations/annotation_parser.php
→
lib/
vendo
r/addendum/annotations/annotation_parser.php
View file @
a4e928e1
...
@@ -20,8 +20,6 @@
...
@@ -20,8 +20,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**/
**/
namespace
Addendum
;
class
CompositeMatcher
{
class
CompositeMatcher
{
protected
$matchers
=
array
();
protected
$matchers
=
array
();
private
$wasConstructed
=
false
;
private
$wasConstructed
=
false
;
...
@@ -334,4 +332,4 @@ namespace Addendum;
...
@@ -334,4 +332,4 @@ namespace Addendum;
return
$matches
[
1
];
return
$matches
[
1
];
}
}
}
}
?>
lib/
Doctrine/ORM/Mapping/Drive
r/addendum/annotations/doc_comment.php
→
lib/
vendo
r/addendum/annotations/doc_comment.php
View file @
a4e928e1
File moved
lib/vendor/addendum/annotations/tests/acceptance_test.php
0 → 100755
View file @
a4e928e1
<?php
require_once
(
'simpletest/autorun.php'
);
require_once
(
'simpletest/mock_objects.php'
);
require_once
(
dirname
(
__FILE__
)
.
'/../../annotations.php'
);
interface
DummyInterface
{}
class
ParentExample
{}
/** @FirstAnnotation @SecondAnnotation */
class
Example
extends
ParentExample
implements
DummyInterface
{
/** @SecondAnnotation */
private
$exampleProperty
;
public
$publicOne
;
public
function
__construct
()
{}
/** @FirstAnnotation */
public
function
exampleMethod
()
{
}
private
function
justPrivate
()
{}
}
/** @FirstAnnotation(1) @FirstAnnotation(2) @SecondAnnotation(3) */
class
MultiExample
{
/** @FirstAnnotation(1) @FirstAnnotation(2) @SecondAnnotation(3) */
public
$property
;
/** @FirstAnnotation(1) @FirstAnnotation(2) @SecondAnnotation(3) */
public
function
aMethod
()
{}
}
class
FirstAnnotation
extends
Annotation
{}
class
SecondAnnotation
extends
Annotation
{}
class
TestOfAnnotations
extends
UnitTestCase
{
public
function
testReflectionAnnotatedClass
()
{
$reflection
=
new
ReflectionAnnotatedClass
(
'Example'
);
$this
->
assertTrue
(
$reflection
->
hasAnnotation
(
'FirstAnnotation'
));
$this
->
assertTrue
(
$reflection
->
hasAnnotation
(
'SecondAnnotation'
));
$this
->
assertFalse
(
$reflection
->
hasAnnotation
(
'NonExistentAnnotation'
));
$this
->
assertIsA
(
$reflection
->
getAnnotation
(
'FirstAnnotation'
),
'FirstAnnotation'
);
$this
->
assertIsA
(
$reflection
->
getAnnotation
(
'SecondAnnotation'
),
'SecondAnnotation'
);
$annotations
=
$reflection
->
getAnnotations
();
$this
->
assertEqual
(
count
(
$annotations
),
2
);
$this
->
assertIsA
(
$annotations
[
0
],
'FirstAnnotation'
);
$this
->
assertIsA
(
$annotations
[
1
],
'SecondAnnotation'
);
$this
->
assertFalse
(
$reflection
->
getAnnotation
(
'NonExistentAnnotation'
));
$this
->
assertIsA
(
$reflection
->
getConstructor
(),
'ReflectionAnnotatedMethod'
);
$this
->
assertIsA
(
$reflection
->
getMethod
(
'exampleMethod'
),
'ReflectionAnnotatedMethod'
);
foreach
(
$reflection
->
getMethods
()
as
$method
)
{
$this
->
assertIsA
(
$method
,
'ReflectionAnnotatedMethod'
);
}
$this
->
assertIsA
(
$reflection
->
getProperty
(
'exampleProperty'
),
'ReflectionAnnotatedProperty'
);
foreach
(
$reflection
->
getProperties
()
as
$property
)
{
$this
->
assertIsA
(
$property
,
'ReflectionAnnotatedProperty'
);
}
foreach
(
$reflection
->
getInterfaces
()
as
$interface
)
{
$this
->
assertIsA
(
$interface
,
'ReflectionAnnotatedClass'
);
}
$this
->
assertIsA
(
$reflection
->
getParentClass
(),
'ReflectionAnnotatedClass'
);
}
public
function
testReflectionAnnotatedMethod
()
{
$reflection
=
new
ReflectionAnnotatedMethod
(
'Example'
,
'exampleMethod'
);
$this
->
assertTrue
(
$reflection
->
hasAnnotation
(
'FirstAnnotation'
));
$this
->
assertFalse
(
$reflection
->
hasAnnotation
(
'NonExistentAnnotation'
));
$this
->
assertIsA
(
$reflection
->
getAnnotation
(
'FirstAnnotation'
),
'FirstAnnotation'
);
$this
->
assertFalse
(
$reflection
->
getAnnotation
(
'NonExistentAnnotation'
));
$annotations
=
$reflection
->
getAnnotations
();
$this
->
assertEqual
(
count
(
$annotations
),
1
);
$this
->
assertIsA
(
$annotations
[
0
],
'FirstAnnotation'
);
$this
->
assertIsA
(
$reflection
->
getDeclaringClass
(),
'ReflectionAnnotatedClass'
);
}
public
function
testReflectionAnnotatedProperty
()
{
$reflection
=
new
ReflectionAnnotatedProperty
(
'Example'
,
'exampleProperty'
);
$this
->
assertTrue
(
$reflection
->
hasAnnotation
(
'SecondAnnotation'
));
$this
->
assertFalse
(
$reflection
->
hasAnnotation
(
'FirstAnnotation'
));
$this
->
assertIsA
(
$reflection
->
getAnnotation
(
'SecondAnnotation'
),
'SecondAnnotation'
);
$this
->
assertFalse
(
$reflection
->
getAnnotation
(
'NonExistentAnnotation'
));
$annotations
=
$reflection
->
getAnnotations
();
$this
->
assertEqual
(
count
(
$annotations
),
1
);
$this
->
assertIsA
(
$annotations
[
0
],
'SecondAnnotation'
);
$this
->
assertIsA
(
$reflection
->
getDeclaringClass
(),
'ReflectionAnnotatedClass'
);
}
public
function
testReflectionClassCanFilterMethodsByAccess
()
{
$reflection
=
new
ReflectionAnnotatedClass
(
'Example'
);
$privateMethods
=
$reflection
->
getMethods
(
ReflectionMethod
::
IS_PRIVATE
);
$this
->
assertEqual
(
count
(
$privateMethods
),
1
);
$this
->
assertEqual
(
$privateMethods
[
0
]
->
getName
(),
'justPrivate'
);
}
public
function
testReflectionClassCanFilterPropertiesByAccess
()
{
$reflection
=
new
ReflectionAnnotatedClass
(
'Example'
);
$privateProperties
=
$reflection
->
getProperties
(
ReflectionProperty
::
IS_PUBLIC
);
$this
->
assertEqual
(
count
(
$privateProperties
),
1
);
$this
->
assertEqual
(
$privateProperties
[
0
]
->
getName
(),
'publicOne'
);
}
public
function
testReflectionClassShouldReturnAllMethodsWithNoFilter
()
{
$reflection
=
new
ReflectionAnnotatedClass
(
'Example'
);
$methods
=
$reflection
->
getMethods
();
$this
->
assertEqual
(
count
(
$methods
),
3
);
}
public
function
testReflectionClassShouldReturnAllPropertiesWithNoFilter
()
{
$reflection
=
new
ReflectionAnnotatedClass
(
'Example'
);
$properties
=
$reflection
->
getProperties
();
$this
->
assertEqual
(
count
(
$properties
),
2
);
}
public
function
testMultipleAnnotationsOnClass
()
{
$reflection
=
new
ReflectionAnnotatedClass
(
'MultiExample'
);
$annotations
=
$reflection
->
getAllAnnotations
();
$this
->
assertEqual
(
count
(
$annotations
),
3
);
$this
->
assertEqual
(
$annotations
[
0
]
->
value
,
1
);
$this
->
assertEqual
(
$annotations
[
1
]
->
value
,
2
);
$this
->
assertEqual
(
$annotations
[
2
]
->
value
,
3
);
$this
->
assertIsA
(
$annotations
[
0
],
'FirstAnnotation'
);
$this
->
assertIsA
(
$annotations
[
1
],
'FirstAnnotation'
);
$this
->
assertIsA
(
$annotations
[
2
],
'SecondAnnotation'
);
}
public
function
testMultipleAnnotationsOnClassWithRestriction
()
{
$reflection
=
new
ReflectionAnnotatedClass
(
'MultiExample'
);
$annotations
=
$reflection
->
getAllAnnotations
(
'FirstAnnotation'
);
$this
->
assertEqual
(
count
(
$annotations
),
2
);
$this
->
assertEqual
(
$annotations
[
0
]
->
value
,
1
);
$this
->
assertEqual
(
$annotations
[
1
]
->
value
,
2
);
$this
->
assertIsA
(
$annotations
[
0
],
'FirstAnnotation'
);
$this
->
assertIsA
(
$annotations
[
1
],
'FirstAnnotation'
);
}
public
function
testMultipleAnnotationsOnProperty
()
{
$reflection
=
new
ReflectionAnnotatedClass
(
'MultiExample'
);
$reflection
=
$reflection
->
getProperty
(
'property'
);
$annotations
=
$reflection
->
getAllAnnotations
();
$this
->
assertEqual
(
count
(
$annotations
),
3
);
$this
->
assertEqual
(
$annotations
[
0
]
->
value
,
1
);
$this
->
assertEqual
(
$annotations
[
1
]
->
value
,
2
);
$this
->
assertEqual
(
$annotations
[
2
]
->
value
,
3
);
$this
->
assertIsA
(
$annotations
[
0
],
'FirstAnnotation'
);
$this
->
assertIsA
(
$annotations
[
1
],
'FirstAnnotation'
);
$this
->
assertIsA
(
$annotations
[
2
],
'SecondAnnotation'
);
}
public
function
testMultipleAnnotationsOnPropertyWithRestriction
()
{
$reflection
=
new
ReflectionAnnotatedClass
(
'MultiExample'
);
$reflection
=
$reflection
->
getProperty
(
'property'
);
$annotations
=
$reflection
->
getAllAnnotations
(
'FirstAnnotation'
);
$this
->
assertEqual
(
count
(
$annotations
),
2
);
$this
->
assertEqual
(
$annotations
[
0
]
->
value
,
1
);
$this
->
assertEqual
(
$annotations
[
1
]
->
value
,
2
);
$this
->
assertIsA
(
$annotations
[
0
],
'FirstAnnotation'
);
$this
->
assertIsA
(
$annotations
[
1
],
'FirstAnnotation'
);
}
public
function
testMultipleAnnotationsOnMethod
()
{
$reflection
=
new
ReflectionAnnotatedClass
(
'MultiExample'
);
$reflection
=
$reflection
->
getMethod
(
'aMethod'
);
$annotations
=
$reflection
->
getAllAnnotations
();
$this
->
assertEqual
(
count
(
$annotations
),
3
);
$this
->
assertEqual
(
$annotations
[
0
]
->
value
,
1
);
$this
->
assertEqual
(
$annotations
[
1
]
->
value
,
2
);
$this
->
assertEqual
(
$annotations
[
2
]
->
value
,
3
);
$this
->
assertIsA
(
$annotations
[
0
],
'FirstAnnotation'
);
$this
->
assertIsA
(
$annotations
[
1
],
'FirstAnnotation'
);
$this
->
assertIsA
(
$annotations
[
2
],
'SecondAnnotation'
);
}
public
function
testMultipleAnnotationsOnMethodWithRestriction
()
{
$reflection
=
new
ReflectionAnnotatedClass
(
'MultiExample'
);
$reflection
=
$reflection
->
getMethod
(
'aMethod'
);
$annotations
=
$reflection
->
getAllAnnotations
(
'FirstAnnotation'
);
$this
->
assertEqual
(
count
(
$annotations
),
2
);
$this
->
assertEqual
(
$annotations
[
0
]
->
value
,
1
);
$this
->
assertEqual
(
$annotations
[
1
]
->
value
,
2
);
$this
->
assertIsA
(
$annotations
[
0
],
'FirstAnnotation'
);
$this
->
assertIsA
(
$annotations
[
1
],
'FirstAnnotation'
);
}
}
Mock
::
generatePartial
(
'AnnotationsBuilder'
,
'MockedAnnotationsBuilder'
,
array
(
'getDocComment'
));
class
TestOfPerformanceFeatures
extends
UnitTestCase
{
public
function
setUp
()
{
AnnotationsBuilder
::
clearCache
();
}
public
function
tearDown
()
{
AnnotationsBuilder
::
clearCache
();
}
public
function
testBuilderShouldCacheResults
()
{
$builder
=
new
MockedAnnotationsBuilder
;
$reflection
=
new
ReflectionClass
(
'Example'
);
$builder
->
build
(
$reflection
);
$builder
->
build
(
$reflection
);
$builder
->
expectOnce
(
'getDocComment'
);
}
}
class
TestOfSupportingFeatures
extends
UnitTestCase
{
public
function
setUp
()
{
Addendum
::
resetIgnoredAnnotations
();
}
public
function
tearDown
()
{
Addendum
::
resetIgnoredAnnotations
();
}
public
function
testIgnoredAnnotationsAreNotUsed
()
{
Addendum
::
ignore
(
'FirstAnnotation'
,
'SecondAnnotation'
);
$reflection
=
new
ReflectionAnnotatedClass
(
'Example'
);
$this
->
assertFalse
(
$reflection
->
hasAnnotation
(
'FirstAnnotation'
));
$this
->
assertFalse
(
$reflection
->
hasAnnotation
(
'SecondAnnotation'
));
}
}
?>
lib/vendor/addendum/annotations/tests/all_tests.php
0 → 100755
View file @
a4e928e1
<?php
require_once
(
'simpletest/unit_tester.php'
);
require_once
(
'simpletest/reporter.php'
);
require_once
(
dirname
(
__FILE__
)
.
'/acceptance_test.php'
);
require_once
(
dirname
(
__FILE__
)
.
'/annotation_test.php'
);
require_once
(
dirname
(
__FILE__
)
.
'/constrained_annotation_test.php'
);
require_once
(
dirname
(
__FILE__
)
.
'/annotation_parser_test.php'
);
require_once
(
dirname
(
__FILE__
)
.
'/doc_comment_test.php'
);
class
AllTests
extends
GroupTest
{
function
__construct
(
$title
=
false
)
{
parent
::
__construct
(
$title
);
$this
->
addTestClass
(
'TestOfAnnotations'
);
$this
->
addTestClass
(
'TestOfPerformanceFeatures'
);
$this
->
addTestClass
(
'TestOfSupportingFeatures'
);
$this
->
addTestClass
(
'TestOfAnnotation'
);
$this
->
addTestClass
(
'TestOfConstrainedAnnotation'
);
$this
->
addTestClass
(
'TestOfMatchers'
);
$this
->
addTestClass
(
'TestOfAnnotationMatchers'
);
$this
->
addTestClass
(
'TestOfDocComment'
);
}
}
Addendum
::
setRawMode
(
false
);
$test
=
new
AllTests
(
'All tests in reflection mode'
);
$test
->
run
(
new
HtmlReporter
());
Addendum
::
setRawMode
(
true
);
$test
=
new
AllTests
(
'All tests in raw mode'
);
$test
->
run
(
new
HtmlReporter
());
?>
lib/vendor/addendum/annotations/tests/annotation_parser_test.php
0 → 100755
View file @
a4e928e1
This diff is collapsed.
Click to expand it.
lib/vendor/addendum/annotations/tests/annotation_test.php
0 → 100755
View file @
a4e928e1
<?php
require_once
(
'simpletest/autorun.php'
);
require_once
(
dirname
(
__FILE__
)
.
'/../../annotations.php'
);
class
TestingAnnotation
extends
Annotation
{
public
$optional
=
'default'
;
public
$required
;
}
class
TestOfAnnotation
extends
UnitTestCase
{
public
function
testConstructorsFillsParameters
()
{
$annotation
=
new
TestingAnnotation
(
array
(
'optional'
=>
1
,
'required'
=>
2
),
$this
);
$this
->
assertEqual
(
$annotation
->
optional
,
1
);
$this
->
assertEqual
(
$annotation
->
required
,
2
);
}
public
function
testConstructorThrowsErrorOnInvalidParameter
()
{
$annotation
=
new
TestingAnnotation
(
array
(
'unknown'
=>
1
),
$this
);
$this
->
assertError
(
"Property 'unknown' not defined for annotation 'TestingAnnotation'"
);
}
public
function
TODO_testConstructorThrowsErrorWithoutSpecifingRequiredParameters
()
{
$annotation
=
new
TestingAnnotation
();
$this
->
assertError
(
"Property 'required' in annotation 'TestingAnnotation' is required"
);
}
}
?>
lib/vendor/addendum/annotations/tests/constrained_annotation_test.php
0 → 100755
View file @
a4e928e1
<?php
require_once
(
'simpletest/autorun.php'
);
require_once
(
dirname
(
__FILE__
)
.
'/../../annotations.php'
);
/** @Target("class") */
class
ClassRestrictedAnnotation
extends
Annotation
{}
/** @Target("method") */
class
MethodRestrictedAnnotation
extends
Annotation
{}
/** @Target("property") */
class
PropertyRestrictedAnnotation
extends
Annotation
{}
/** @Target({"class", "property"}) */
class
ClassOrPropertyRestrictedAnnotation
extends
Annotation
{}
class
BadlyAnnotatedClass
{
/** @ClassRestrictedAnnotation */
private
$property
;
/** @ClassRestrictedAnnotation */
public
function
method
()
{}
/** @ClassOrPropertyRestrictedAnnotation */
public
function
method2
()
{}
}
/** @ClassRestrictedAnnotation */
class
SuccesfullyAnnotatedClass
{
/** @PropertyRestrictedAnnotation */
private
$property
;
/** @ClassOrPropertyRestrictedAnnotation */
private
$property2
;
/** @MethodRestrictedAnnotation */
public
function
method
()
{}
}
class
TestOfConstrainedAnnotation
extends
UnitTestCase
{
public
function
testClassAnnotationThrowsErrorWhenOnMethod
()
{
$this
->
expectError
(
"Annotation 'ClassRestrictedAnnotation' not allowed on BadlyAnnotatedClass::method"
);
$reflection
=
new
ReflectionAnnotatedClass
(
'BadlyAnnotatedClass'
);
$method
=
$reflection
->
getMethod
(
'method'
);
}
public
function
testClassAnnotationThrowsErrorWhenOnProperty
()
{
$this
->
expectError
(
"Annotation 'ClassRestrictedAnnotation' not allowed on BadlyAnnotatedClass::
\$
property"
);
$reflection
=
new
ReflectionAnnotatedClass
(
'BadlyAnnotatedClass'
);
$method
=
$reflection
->
getProperty
(
'property'
);
}
public
function
testSingleTargetAnnotationThrowsNoErrorWhenOnRightPlace
()
{
$reflection
=
new
ReflectionAnnotatedClass
(
'SuccesfullyAnnotatedClass'
);
$method
=
$reflection
->
getMethod
(
'method'
);
$property
=
$reflection
->
getProperty
(
'property'
);
$this
->
assertNoErrors
();
}
public
function
testMultiTargetAnnotationThrowsErrorWhenOnWrongPlace
()
{
$this
->
expectError
(
"Annotation 'ClassOrPropertyRestrictedAnnotation' not allowed on BadlyAnnotatedClass::method2"
);
$reflection
=
new
ReflectionAnnotatedClass
(
'BadlyAnnotatedClass'
);
$method
=
$reflection
->
getMethod
(
'method2'
);
}
public
function
testMultiTargetAnnotationThrowsNoErrorWhenOnRightPlace
()
{
$reflection
=
new
ReflectionAnnotatedClass
(
'SuccesfullyAnnotatedClass'
);
$method
=
$reflection
->
getProperty
(
'property2'
);
$this
->
assertNoErrors
();
}
}
?>
\ No newline at end of file
lib/vendor/addendum/annotations/tests/doc_comment_test.php
0 → 100755
View file @
a4e928e1
<?php
require_once
(
'simpletest/autorun.php'
);
require_once
(
'simpletest/mock_objects.php'
);
require_once
(
dirname
(
__FILE__
)
.
'/../doc_comment.php'
);
Mock
::
generatePartial
(
'DocComment'
,
'MockDocComment'
,
array
(
'parse'
));
/** class doccomment */
class
SomeClass
{
/** field doccomment */
private
$field1
;
private
$field2
;
/** method1 doccomment */
public
function
method1
()
{
}
public
function
method2
()
{}
/** bad one */
}
class
SomeOtherClass
{
/** field doccomment */
private
$field1
;
}
class
TestOfDocComment
extends
UnitTestCase
{
public
function
setUp
()
{
DocComment
::
clearCache
();
}
public
function
testFinderFindsClassDocBlock
()
{
$reflection
=
new
ReflectionClass
(
'SomeClass'
);
$finder
=
new
DocComment
();
$this
->
assertEqual
(
$finder
->
get
(
$reflection
),
'/** class doccomment */'
);
}
public
function
testFinderFindsFieldDocBlock
()
{
$reflection
=
new
ReflectionClass
(
'SomeClass'
);
$property
=
$reflection
->
getProperty
(
'field1'
);
$finder
=
new
DocComment
();
$this
->
assertEqual
(
$finder
->
get
(
$property
),
'/** field doccomment */'
);
$property
=
$reflection
->
getProperty
(
'field2'
);
$finder
=
new
DocComment
();
$this
->
assertFalse
(
$finder
->
get
(
$property
));
}
public
function
testFinderFindsMethodDocBlock
()
{
$reflection
=
new
ReflectionClass
(
'SomeClass'
);
$method
=
$reflection
->
getMethod
(
'method1'
);
$finder
=
new
DocComment
();
$this
->
assertEqual
(
$finder
->
get
(
$method
),
'/** method1 doccomment */'
);
$method
=
$reflection
->
getMethod
(
'method2'
);
$finder
=
new
DocComment
();
$this
->
assertFalse
(
$finder
->
get
(
$method
));
}
public
function
testMisplacedDocCommentDoesNotCausesDisaster
()
{
$reflection
=
new
ReflectionClass
(
'SomeOtherClass'
);
$finder
=
new
DocComment
();
$this
->
assertEqual
(
$finder
->
get
(
$reflection
),
false
);
}
public
function
testUnanotatedClassCanHaveAnotatedField
()
{
$reflection
=
new
ReflectionClass
(
'SomeOtherClass'
);
$property
=
$reflection
->
getProperty
(
'field1'
);
$finder
=
new
DocComment
();
$this
->
assertEqual
(
$finder
->
get
(
$property
),
'/** field doccomment */'
);
}
public
function
testParserIsOnlyCalledOncePerFile
()
{
$reflection
=
new
ReflectionClass
(
'SomeClass'
);
$finder
=
new
MockDocComment
();
$finder
->
expectOnce
(
'parse'
);
$this
->
assertEqual
(
$finder
->
get
(
$reflection
),
false
);
$this
->
assertEqual
(
$finder
->
get
(
$reflection
),
false
);
$reflection
=
new
ReflectionClass
(
'SomeClass'
);
$finder
=
new
MockDocComment
();
$finder
->
expectNever
(
'parse'
);
$this
->
assertEqual
(
$finder
->
get
(
$reflection
),
false
);
}
}
?>
tests/Doctrine/Tests/ORM/Functional/SingleTableInheritanceTest.php
View file @
a4e928e1
...
@@ -13,11 +13,17 @@ class SingleTableInheritanceTest extends \Doctrine\Tests\OrmFunctionalTestCase
...
@@ -13,11 +13,17 @@ class SingleTableInheritanceTest extends \Doctrine\Tests\OrmFunctionalTestCase
{
{
protected
function
setUp
()
{
protected
function
setUp
()
{
parent
::
setUp
();
parent
::
setUp
();
try
{
$this
->
_schemaTool
->
createSchema
(
array
(
$this
->
_schemaTool
->
createSchema
(
array
(
$this
->
_em
->
getClassMetadata
(
'Doctrine\Tests\ORM\Functional\ParentEntity'
),
$this
->
_em
->
getClassMetadata
(
'Doctrine\Tests\ORM\Functional\ParentEntity'
),
$this
->
_em
->
getClassMetadata
(
'Doctrine\Tests\ORM\Functional\ChildEntity'
),
$this
->
_em
->
getClassMetadata
(
'Doctrine\Tests\ORM\Functional\ChildEntity'
),
$this
->
_em
->
getClassMetadata
(
'Doctrine\Tests\ORM\Functional\RelatedEntity'
)
$this
->
_em
->
getClassMetadata
(
'Doctrine\Tests\ORM\Functional\RelatedEntity'
)
));
));
}
catch
(
\Exception
$e
)
{
if
(
stripos
(
$e
->
getMessage
(),
'already exists'
)
===
false
)
{
throw
$e
;
}
}
}
}
public
function
testCRUD
()
public
function
testCRUD
()
...
...
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