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
81bc672e
Commit
81bc672e
authored
Dec 27, 2006
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
71b218e7
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
504 additions
and
0 deletions
+504
-0
FirebirdTestCase.php
tests/Connection/FirebirdTestCase.php
+61
-0
InformixTestCase.php
tests/Connection/InformixTestCase.php
+61
-0
MssqlTestCase.php
tests/Connection/MssqlTestCase.php
+61
-0
PgsqlTestCase.php
tests/Connection/PgsqlTestCase.php
+143
-0
ChainTestCase.php
tests/EventListener/ChainTestCase.php
+34
-0
StateTestCase.php
tests/Record/StateTestCase.php
+110
-0
template.tpl
tests/template.tpl
+34
-0
No files found.
tests/Connection/FirebirdTestCase.php
0 → 100644
View file @
81bc672e
<?php
class
Doctrine_Connection_Firebird_TestCase
extends
Doctrine_Driver_UnitTestCase
{
public
function
__construct
()
{
parent
::
__construct
(
'sqlite'
);
}
public
function
testNoSuchTableErrorIsSupported
()
{
$this
->
exc
->
processErrorInfo
(
array
(
0
,
0
,
'no such table: test1'
));
$this
->
assertEqual
(
$this
->
exc
->
getPortableCode
(),
Doctrine
::
ERR_NOSUCHTABLE
);
}
public
function
testNoSuchIndexErrorIsSupported
()
{
$this
->
exc
->
processErrorInfo
(
array
(
0
,
0
,
'no such index: test1'
));
$this
->
assertEqual
(
$this
->
exc
->
getPortableCode
(),
Doctrine
::
ERR_NOT_FOUND
);
}
public
function
testUniquePrimaryKeyErrorIsSupported
()
{
$this
->
exc
->
processErrorInfo
(
array
(
0
,
0
,
'PRIMARY KEY must be unique'
));
$this
->
assertEqual
(
$this
->
exc
->
getPortableCode
(),
Doctrine
::
ERR_CONSTRAINT
);
}
public
function
testIsNotUniqueErrorIsSupported
()
{
$this
->
exc
->
processErrorInfo
(
array
(
0
,
0
,
'is not unique'
));
$this
->
assertEqual
(
$this
->
exc
->
getPortableCode
(),
Doctrine
::
ERR_CONSTRAINT
);
}
public
function
testColumnsNotUniqueErrorIsSupported
()
{
$this
->
exc
->
processErrorInfo
(
array
(
0
,
0
,
'columns name, id are not unique'
));
$this
->
assertEqual
(
$this
->
exc
->
getPortableCode
(),
Doctrine
::
ERR_CONSTRAINT
);
}
public
function
testUniquenessConstraintErrorIsSupported
()
{
$this
->
exc
->
processErrorInfo
(
array
(
0
,
0
,
'uniqueness constraint failed'
));
$this
->
assertEqual
(
$this
->
exc
->
getPortableCode
(),
Doctrine
::
ERR_CONSTRAINT
);
}
public
function
testNotNullConstraintErrorIsSupported
()
{
$this
->
exc
->
processErrorInfo
(
array
(
0
,
0
,
'may not be NULL'
));
$this
->
assertEqual
(
$this
->
exc
->
getPortableCode
(),
Doctrine
::
ERR_CONSTRAINT_NOT_NULL
);
}
public
function
testNoSuchFieldErrorIsSupported
()
{
$this
->
exc
->
processErrorInfo
(
array
(
0
,
0
,
'no such column: column1'
));
$this
->
assertEqual
(
$this
->
exc
->
getPortableCode
(),
Doctrine
::
ERR_NOSUCHFIELD
);
}
public
function
testColumnNotPresentInTablesErrorIsSupported2
()
{
$this
->
exc
->
processErrorInfo
(
array
(
0
,
0
,
'column not present in both tables'
));
$this
->
assertEqual
(
$this
->
exc
->
getPortableCode
(),
Doctrine
::
ERR_NOSUCHFIELD
);
}
public
function
testNearSyntaxErrorIsSupported
()
{
$this
->
exc
->
processErrorInfo
(
array
(
0
,
0
,
"near
\"
SELECT FROM
\"
: syntax error"
));
$this
->
assertEqual
(
$this
->
exc
->
getPortableCode
(),
Doctrine
::
ERR_SYNTAX
);
}
public
function
testValueCountOnRowErrorIsSupported
()
{
$this
->
exc
->
processErrorInfo
(
array
(
0
,
0
,
'3 values for 2 columns'
));
$this
->
assertEqual
(
$this
->
exc
->
getPortableCode
(),
Doctrine
::
ERR_VALUE_COUNT_ON_ROW
);
}
}
tests/Connection/InformixTestCase.php
0 → 100644
View file @
81bc672e
<?php
class
Doctrine_Connection_Informix_TestCase
extends
Doctrine_Driver_UnitTestCase
{
public
function
__construct
()
{
parent
::
__construct
(
'sqlite'
);
}
public
function
testNoSuchTableErrorIsSupported
()
{
$this
->
exc
->
processErrorInfo
(
array
(
0
,
0
,
'no such table: test1'
));
$this
->
assertEqual
(
$this
->
exc
->
getPortableCode
(),
Doctrine
::
ERR_NOSUCHTABLE
);
}
public
function
testNoSuchIndexErrorIsSupported
()
{
$this
->
exc
->
processErrorInfo
(
array
(
0
,
0
,
'no such index: test1'
));
$this
->
assertEqual
(
$this
->
exc
->
getPortableCode
(),
Doctrine
::
ERR_NOT_FOUND
);
}
public
function
testUniquePrimaryKeyErrorIsSupported
()
{
$this
->
exc
->
processErrorInfo
(
array
(
0
,
0
,
'PRIMARY KEY must be unique'
));
$this
->
assertEqual
(
$this
->
exc
->
getPortableCode
(),
Doctrine
::
ERR_CONSTRAINT
);
}
public
function
testIsNotUniqueErrorIsSupported
()
{
$this
->
exc
->
processErrorInfo
(
array
(
0
,
0
,
'is not unique'
));
$this
->
assertEqual
(
$this
->
exc
->
getPortableCode
(),
Doctrine
::
ERR_CONSTRAINT
);
}
public
function
testColumnsNotUniqueErrorIsSupported
()
{
$this
->
exc
->
processErrorInfo
(
array
(
0
,
0
,
'columns name, id are not unique'
));
$this
->
assertEqual
(
$this
->
exc
->
getPortableCode
(),
Doctrine
::
ERR_CONSTRAINT
);
}
public
function
testUniquenessConstraintErrorIsSupported
()
{
$this
->
exc
->
processErrorInfo
(
array
(
0
,
0
,
'uniqueness constraint failed'
));
$this
->
assertEqual
(
$this
->
exc
->
getPortableCode
(),
Doctrine
::
ERR_CONSTRAINT
);
}
public
function
testNotNullConstraintErrorIsSupported
()
{
$this
->
exc
->
processErrorInfo
(
array
(
0
,
0
,
'may not be NULL'
));
$this
->
assertEqual
(
$this
->
exc
->
getPortableCode
(),
Doctrine
::
ERR_CONSTRAINT_NOT_NULL
);
}
public
function
testNoSuchFieldErrorIsSupported
()
{
$this
->
exc
->
processErrorInfo
(
array
(
0
,
0
,
'no such column: column1'
));
$this
->
assertEqual
(
$this
->
exc
->
getPortableCode
(),
Doctrine
::
ERR_NOSUCHFIELD
);
}
public
function
testColumnNotPresentInTablesErrorIsSupported2
()
{
$this
->
exc
->
processErrorInfo
(
array
(
0
,
0
,
'column not present in both tables'
));
$this
->
assertEqual
(
$this
->
exc
->
getPortableCode
(),
Doctrine
::
ERR_NOSUCHFIELD
);
}
public
function
testNearSyntaxErrorIsSupported
()
{
$this
->
exc
->
processErrorInfo
(
array
(
0
,
0
,
"near
\"
SELECT FROM
\"
: syntax error"
));
$this
->
assertEqual
(
$this
->
exc
->
getPortableCode
(),
Doctrine
::
ERR_SYNTAX
);
}
public
function
testValueCountOnRowErrorIsSupported
()
{
$this
->
exc
->
processErrorInfo
(
array
(
0
,
0
,
'3 values for 2 columns'
));
$this
->
assertEqual
(
$this
->
exc
->
getPortableCode
(),
Doctrine
::
ERR_VALUE_COUNT_ON_ROW
);
}
}
tests/Connection/MssqlTestCase.php
0 → 100644
View file @
81bc672e
<?php
class
Doctrine_Connection_Mssql_TestCase
extends
Doctrine_Driver_UnitTestCase
{
public
function
__construct
()
{
parent
::
__construct
(
'sqlite'
);
}
public
function
testNoSuchTableErrorIsSupported
()
{
$this
->
exc
->
processErrorInfo
(
array
(
0
,
0
,
'no such table: test1'
));
$this
->
assertEqual
(
$this
->
exc
->
getPortableCode
(),
Doctrine
::
ERR_NOSUCHTABLE
);
}
public
function
testNoSuchIndexErrorIsSupported
()
{
$this
->
exc
->
processErrorInfo
(
array
(
0
,
0
,
'no such index: test1'
));
$this
->
assertEqual
(
$this
->
exc
->
getPortableCode
(),
Doctrine
::
ERR_NOT_FOUND
);
}
public
function
testUniquePrimaryKeyErrorIsSupported
()
{
$this
->
exc
->
processErrorInfo
(
array
(
0
,
0
,
'PRIMARY KEY must be unique'
));
$this
->
assertEqual
(
$this
->
exc
->
getPortableCode
(),
Doctrine
::
ERR_CONSTRAINT
);
}
public
function
testIsNotUniqueErrorIsSupported
()
{
$this
->
exc
->
processErrorInfo
(
array
(
0
,
0
,
'is not unique'
));
$this
->
assertEqual
(
$this
->
exc
->
getPortableCode
(),
Doctrine
::
ERR_CONSTRAINT
);
}
public
function
testColumnsNotUniqueErrorIsSupported
()
{
$this
->
exc
->
processErrorInfo
(
array
(
0
,
0
,
'columns name, id are not unique'
));
$this
->
assertEqual
(
$this
->
exc
->
getPortableCode
(),
Doctrine
::
ERR_CONSTRAINT
);
}
public
function
testUniquenessConstraintErrorIsSupported
()
{
$this
->
exc
->
processErrorInfo
(
array
(
0
,
0
,
'uniqueness constraint failed'
));
$this
->
assertEqual
(
$this
->
exc
->
getPortableCode
(),
Doctrine
::
ERR_CONSTRAINT
);
}
public
function
testNotNullConstraintErrorIsSupported
()
{
$this
->
exc
->
processErrorInfo
(
array
(
0
,
0
,
'may not be NULL'
));
$this
->
assertEqual
(
$this
->
exc
->
getPortableCode
(),
Doctrine
::
ERR_CONSTRAINT_NOT_NULL
);
}
public
function
testNoSuchFieldErrorIsSupported
()
{
$this
->
exc
->
processErrorInfo
(
array
(
0
,
0
,
'no such column: column1'
));
$this
->
assertEqual
(
$this
->
exc
->
getPortableCode
(),
Doctrine
::
ERR_NOSUCHFIELD
);
}
public
function
testColumnNotPresentInTablesErrorIsSupported2
()
{
$this
->
exc
->
processErrorInfo
(
array
(
0
,
0
,
'column not present in both tables'
));
$this
->
assertEqual
(
$this
->
exc
->
getPortableCode
(),
Doctrine
::
ERR_NOSUCHFIELD
);
}
public
function
testNearSyntaxErrorIsSupported
()
{
$this
->
exc
->
processErrorInfo
(
array
(
0
,
0
,
"near
\"
SELECT FROM
\"
: syntax error"
));
$this
->
assertEqual
(
$this
->
exc
->
getPortableCode
(),
Doctrine
::
ERR_SYNTAX
);
}
public
function
testValueCountOnRowErrorIsSupported
()
{
$this
->
exc
->
processErrorInfo
(
array
(
0
,
0
,
'3 values for 2 columns'
));
$this
->
assertEqual
(
$this
->
exc
->
getPortableCode
(),
Doctrine
::
ERR_VALUE_COUNT_ON_ROW
);
}
}
tests/Connection/PgsqlTestCase.php
0 → 100644
View file @
81bc672e
<?php
class
Doctrine_Connection_Pgsql_TestCase
extends
Doctrine_UnitTestCase
{
public
function
__construct
()
{
parent
::
__construct
(
'pgsql'
);
}
public
function
testNoSuchTableErrorIsSupported
()
{
$this
->
assertTrue
(
$this
->
exc
->
processErrorInfo
(
array
(
0
,
0
,
'table test does not exist'
)));
$this
->
assertEqual
(
$this
->
exc
->
getPortableCode
(),
Doctrine
::
ERR_NOSUCHTABLE
);
}
public
function
testSyntaxErrorIsSupported
()
{
$this
->
assertTrue
(
$this
->
exc
->
processErrorInfo
(
array
(
0
,
0
,
'parser: parse error at or near'
)));
$this
->
assertEqual
(
$this
->
exc
->
getPortableCode
(),
Doctrine
::
ERR_SYNTAX
);
}
public
function
testSyntaxErrorIsSupported2
()
{
$this
->
assertTrue
(
$this
->
exc
->
processErrorInfo
(
array
(
0
,
0
,
'syntax error at'
)));
$this
->
assertEqual
(
$this
->
exc
->
getPortableCode
(),
Doctrine
::
ERR_SYNTAX
);
}
public
function
testSyntaxErrorIsSupported3
()
{
$this
->
assertTrue
(
$this
->
exc
->
processErrorInfo
(
array
(
0
,
0
,
'column reference r.r is ambiguous'
)));
$this
->
assertEqual
(
$this
->
exc
->
getPortableCode
(),
Doctrine
::
ERR_SYNTAX
);
}
public
function
testInvalidNumberErrorIsSupported
()
{
$this
->
assertTrue
(
$this
->
exc
->
processErrorInfo
(
array
(
0
,
0
,
'pg_atoi: error in somewhere: can\'t parse '
)));
$this
->
assertEqual
(
$this
->
exc
->
getPortableCode
(),
Doctrine
::
ERR_INVALID_NUMBER
);
}
public
function
testInvalidNumberErrorIsSupported2
()
{
$this
->
assertTrue
(
$this
->
exc
->
processErrorInfo
(
array
(
0
,
0
,
'value unknown is out of range for type bigint'
)));
$this
->
assertEqual
(
$this
->
exc
->
getPortableCode
(),
Doctrine
::
ERR_INVALID_NUMBER
);
}
public
function
testInvalidNumberErrorIsSupported3
()
{
$this
->
assertTrue
(
$this
->
exc
->
processErrorInfo
(
array
(
0
,
0
,
'integer out of range'
)));
$this
->
assertEqual
(
$this
->
exc
->
getPortableCode
(),
Doctrine
::
ERR_INVALID_NUMBER
);
}
public
function
testInvalidNumberErrorIsSupported4
()
{
$this
->
assertTrue
(
$this
->
exc
->
processErrorInfo
(
array
(
0
,
0
,
'invalid input syntax for type integer'
)));
$this
->
assertEqual
(
$this
->
exc
->
getPortableCode
(),
Doctrine
::
ERR_INVALID_NUMBER
);
}
/**
'/column .* (of relation .*)?does not exist/i'
=> Doctrine::ERR_NOSUCHFIELD,
'/attribute .* not found|relation .* does not have attribute/i'
=> Doctrine::ERR_NOSUCHFIELD,
'/column .* specified in USING clause does not exist in (left|right) table/i'
=> Doctrine::ERR_NOSUCHFIELD,
'/(relation|sequence|table).*does not exist|class .* not found/i'
=> Doctrine::ERR_NOSUCHTABLE,
'/index .* does not exist/'
=> Doctrine::ERR_NOT_FOUND,
'/relation .* already exists/i'
=> Doctrine::ERR_ALREADY_EXISTS,
'/(divide|division) by zero$/i'
=> Doctrine::ERR_DIVZERO,
'/value too long for type character/i'
=> Doctrine::ERR_INVALID,
'/permission denied/'
=> Doctrine::ERR_ACCESS_VIOLATION,
'/violates [\w ]+ constraint/'
=> Doctrine::ERR_CONSTRAINT,
'/referential integrity violation/'
=> Doctrine::ERR_CONSTRAINT,
'/violates not-null constraint/'
=> Doctrine::ERR_CONSTRAINT_NOT_NULL,
'/more expressions than target columns/i'
=> Doctrine::ERR_VALUE_COUNT_ON_ROW,
public function testNoSuchFieldErrorIsSupported() {
$this->exc->processErrorInfo(array(0, 904, ''));
$this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_NOSUCHFIELD);
}
public function testConstraintErrorIsSupported() {
$this->exc->processErrorInfo(array(0, 1, ''));
$this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_CONSTRAINT);
}
public function testConstraintErrorIsSupported2() {
$this->exc->processErrorInfo(array(0, 2291, ''));
$this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_CONSTRAINT);
}
public function testConstraintErrorIsSupported3() {
$this->exc->processErrorInfo(array(0, 2449, ''));
$this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_CONSTRAINT);
}
public function testConstraintErrorIsSupported4() {
$this->exc->processErrorInfo(array(0, 2292, ''));
$this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_CONSTRAINT);
}
public function testNoSuchTableErrorIsSupported4() {
$this->exc->processErrorInfo(array(0, 2289, ''));
$this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_NOSUCHTABLE);
}
public function testDivZeroErrorIsSupported1() {
$this->exc->processErrorInfo(array(0, 1476, ''));
$this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_DIVZERO);
}
public function testNotFoundErrorIsSupported() {
$this->exc->processErrorInfo(array(0, 1418, ''));
$this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_NOT_FOUND);
}
public function testNotNullConstraintErrorIsSupported() {
$this->exc->processErrorInfo(array(0, 1400, ''));
$this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_CONSTRAINT_NOT_NULL);
}
public function testNotNullConstraintErrorIsSupported2() {
$this->exc->processErrorInfo(array(0, 1407, ''));
$this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_CONSTRAINT_NOT_NULL);
}
public function testInvalidErrorIsSupported() {
$this->exc->processErrorInfo(array(0, 1401, ''));
$this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_INVALID);
}
public function testAlreadyExistsErrorIsSupported() {
$this->exc->processErrorInfo(array(0, 955, ''));
$this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_ALREADY_EXISTS);
}
public function testValueCountOnRowErrorIsSupported() {
$this->exc->processErrorInfo(array(0, 913, ''));
$this->assertEqual($this->exc->getPortableCode(), Doctrine::ERR_VALUE_COUNT_ON_ROW);
}
*/
}
tests/EventListener/ChainTestCase.php
0 → 100644
View file @
81bc672e
<?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_EventListener_Chain_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_EventListener_Chain_TestCase
extends
Doctrine_UnitTestCase
{
}
tests/Record/StateTestCase.php
0 → 100644
View file @
81bc672e
<?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_State_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_State_TestCase
extends
Doctrine_UnitTestCase
{
public
function
prepareTables
()
{
}
public
function
prepareData
()
{
}
public
function
testAssignUnknownState
()
{
$user
=
new
User
();
try
{
$user
->
state
(
123123
);
$this
->
fail
();
}
catch
(
Doctrine_Record_State_Exception
$e
)
{
$this
->
pass
();
}
$this
->
assertEqual
(
$user
->
state
(),
Doctrine_Record
::
STATE_TCLEAN
);
try
{
$user
->
state
(
'some unknown state'
);
$this
->
fail
();
}
catch
(
Doctrine_Record_State_Exception
$e
)
{
$this
->
pass
();
}
$this
->
assertEqual
(
$user
->
state
(),
Doctrine_Record
::
STATE_TCLEAN
);
}
public
function
testAssignDirtyState
()
{
$user
=
new
User
();
$user
->
state
(
Doctrine_Record
::
STATE_DIRTY
);
$this
->
assertEqual
(
$user
->
state
(),
Doctrine_Record
::
STATE_DIRTY
);
$user
->
state
(
'dirty'
);
$this
->
assertEqual
(
$user
->
state
(),
Doctrine_Record
::
STATE_DIRTY
);
}
public
function
testAssignCleanState
()
{
$user
=
new
User
();
$user
->
state
(
Doctrine_Record
::
STATE_CLEAN
);
$this
->
assertEqual
(
$user
->
state
(),
Doctrine_Record
::
STATE_CLEAN
);
$user
->
state
(
'clean'
);
$this
->
assertEqual
(
$user
->
state
(),
Doctrine_Record
::
STATE_CLEAN
);
}
public
function
testAssignTransientCleanState
()
{
$user
=
new
User
();
$user
->
state
(
Doctrine_Record
::
STATE_TCLEAN
);
$this
->
assertEqual
(
$user
->
state
(),
Doctrine_Record
::
STATE_TCLEAN
);
$user
->
state
(
'tclean'
);
$this
->
assertEqual
(
$user
->
state
(),
Doctrine_Record
::
STATE_TCLEAN
);
}
public
function
testAssignTransientDirtyState
()
{
$user
=
new
User
();
$user
->
state
(
Doctrine_Record
::
STATE_TDIRTY
);
$this
->
assertEqual
(
$user
->
state
(),
Doctrine_Record
::
STATE_TDIRTY
);
$user
->
state
(
'tdirty'
);
$this
->
assertEqual
(
$user
->
state
(),
Doctrine_Record
::
STATE_TDIRTY
);
}
public
function
testAssignProxyState
()
{
$user
=
new
User
();
$user
->
state
(
Doctrine_Record
::
STATE_PROXY
);
$this
->
assertEqual
(
$user
->
state
(),
Doctrine_Record
::
STATE_PROXY
);
$user
->
state
(
'proxy'
);
$this
->
assertEqual
(
$user
->
state
(),
Doctrine_Record
::
STATE_PROXY
);
}
}
tests/template.tpl
0 → 100644
View file @
81bc672e
<
?
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
>
.
*/
/**
* %s
*
* @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 %s extends Doctrine_UnitTestCase {
}
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