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
c606da1a
Commit
c606da1a
authored
Sep 12, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
3a93d7f2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
5 deletions
+55
-5
I18nTestCase.php
tests/I18nTestCase.php
+55
-5
No files found.
tests/I18nTestCase.php
View file @
c606da1a
...
...
@@ -38,10 +38,60 @@ class Doctrine_I18n_TestCase extends Doctrine_UnitTestCase
public
function
prepareTables
()
{
$this
->
profiler
=
new
Doctrine_Connection_Profiler
();
$this
->
conn
->
addListener
(
$this
->
profiler
);
$this
->
tables
=
array
(
'I18nTest'
,
'I18nTestTranslation'
);
$this
->
tables
=
array
();
parent
::
prepareTables
();
}
public
function
testTranslationTableGetsExported
()
{
$this
->
conn
->
setAttribute
(
Doctrine
::
ATTR_EXPORT
,
Doctrine
::
EXPORT_ALL
);
$this
->
assertTrue
(
Doctrine
::
EXPORT_ALL
&
Doctrine
::
EXPORT_TABLES
);
$this
->
assertTrue
(
Doctrine
::
EXPORT_ALL
&
Doctrine
::
EXPORT_CONSTRAINTS
);
$this
->
assertTrue
(
Doctrine
::
EXPORT_ALL
&
Doctrine
::
EXPORT_PLUGINS
);
$sql
=
$this
->
conn
->
export
->
exportClassesSql
(
array
(
'I18nTest'
));
foreach
(
$sql
as
$query
)
{
$this
->
conn
->
exec
(
$query
);
}
}
public
function
testTranslationTableIsInitializedProperly
()
{
$i
=
new
I18nTest
();
$i
->
name
=
'some name'
;
$i
->
title
=
'some title'
;
$this
->
assertEqual
(
$i
->
Translation
->
getTable
()
->
getComponentName
(),
'I18nTestTranslation'
);
$i
->
Translation
[
'FI'
]
->
name
=
'joku nimi'
;
$i
->
Translation
[
'FI'
]
->
title
=
'joku otsikko'
;
$i
->
Translation
[
'FI'
]
->
lang
=
'FI'
;
$i
->
save
();
$this
->
conn
->
clear
();
$t
=
Doctrine_Query
::
create
()
->
from
(
'I18nTestTranslation'
)
->
fetchOne
();
$this
->
assertEqual
(
$t
->
name
,
'joku nimi'
);
$this
->
assertEqual
(
$t
->
title
,
'joku otsikko'
);
$this
->
assertEqual
(
$t
->
lang
,
'FI'
);
}
public
function
testDataFetching
()
{
$i
=
Doctrine_Query
::
create
()
->
from
(
'I18nTest i'
)
->
innerJoin
(
'i.Translation t INDEXBY t.lang'
)
->
fetchOne
(
array
(),
Doctrine
::
HYDRATE_ARRAY
);
$this
->
assertEqual
(
$i
[
'name'
],
'some name'
);
$this
->
assertEqual
(
$i
[
'title'
],
'some title'
);
$this
->
assertEqual
(
$i
[
'Translation'
][
'FI'
][
'name'
],
'joku nimi'
);
$this
->
assertEqual
(
$i
[
'Translation'
][
'FI'
][
'title'
],
'joku otsikko'
);
$this
->
assertEqual
(
$i
[
'Translation'
][
'FI'
][
'lang'
],
'FI'
);
}
}
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