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
9fcf6cc1
Commit
9fcf6cc1
authored
Jul 23, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
c26ed844
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
69 deletions
+6
-69
ImportTestCase.php
tests/ImportTestCase.php
+6
-69
No files found.
tests/ImportTestCase.php
View file @
9fcf6cc1
...
...
@@ -32,84 +32,21 @@
*/
class
Doctrine_Import_TestCase
extends
Doctrine_UnitTestCase
{
public
function
prepareTables
()
{
}
public
function
prepareData
()
{
}
public
function
setUp
()
{
parent
::
setUp
();
//reading
$reader
=
new
Doctrine_Import_Reader_Db
();
$reader
->
setPdo
(
$this
->
dbh
);
$this
->
schema
=
$reader
->
read
();
}
public
function
testBadImport
()
public
function
testImport
()
{
$builder
=
new
Doctrine_Import_Builder
();
try
{
$builder
->
buildRecord
(
new
Doctrine_Schema_Table
());
$this
->
fail
();
}
catch
(
Doctrine_Import_Builder_Exception
$e
)
{
$this
->
pass
();
}
}
public
function
testImportTable
()
{
$definition
=
array
(
'name'
=>
'import_test'
);
$table
=
new
Doctrine_Schema_Table
(
$definition
);
$def
=
array
(
'name'
=>
'name'
,
'type'
=>
'string'
,
'length'
=>
20
,
'default'
=>
'someone'
);
$this
->
dbh
=
new
PDO
(
'sqlite::memory:'
);
$t
able
->
addColumn
(
new
Doctrine_Schema_Column
(
$def
)
);
$t
his
->
dbh
->
exec
(
'CREATE TABLE import_test_user (id INTEGER PRIMARY KEY, name TEXT)'
);
$def
=
array
(
'name'
=>
'created'
,
'type'
=>
'integer'
,
'notnull'
=>
true
);
$this
->
conn
=
Doctrine_Manager
::
connection
(
$this
->
dbh
);
$table
->
addColumn
(
new
Doctrine_Schema_Column
(
$def
));
$builder
=
new
Doctrine_Import_Builder
();
$builder
->
setTargetPath
(
'tmp'
);
try
{
$builder
->
buildRecord
(
$table
);
$this
->
pass
();
}
catch
(
Doctrine_Import_Builder_Exception
$e
)
{
$this
->
fail
();
}
$this
->
assertTrue
(
file_exists
(
'tmp'
.
DIRECTORY_SEPARATOR
.
'ImportTest.php'
));
}
public
function
testImportedComponent
()
{
require_once
(
'tmp'
.
DIRECTORY_SEPARATOR
.
'ImportTest.php'
);
$r
=
new
ImportTest
();
$columns
=
$r
->
getTable
()
->
getColumns
();
// id column is auto-created
$this
->
conn
->
import
->
import
(
'Import/_files'
);
$this
->
assertEqual
(
$columns
[
'id'
][
0
],
'integer'
);
$this
->
assertEqual
(
$columns
[
'id'
][
1
],
20
);
$this
->
assertEqual
(
$columns
[
'name'
][
0
],
'string'
);
$this
->
assertEqual
(
$columns
[
'name'
][
1
],
20
);
$this
->
assertEqual
(
$columns
[
'created'
][
0
],
'integer'
);
unlink
(
'tmp'
.
DIRECTORY_SEPARATOR
.
'ImportTest.php'
);
$this
->
assertTrue
(
file_exists
(
'Import/_files/ImportTestUser.php'
));
}
}
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