Skip to content

Commit

Permalink
Refactored how to prepare unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
willdurand committed Nov 23, 2011
1 parent b9489cd commit c3b023f
Show file tree
Hide file tree
Showing 13 changed files with 55 additions and 112 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,10 @@ tests/Fixtures/bookstore/build/
tests/Fixtures/namespaced/build/
tests/Fixtures/nestedset/build/
tests/Fixtures/schemas/build/
tests/Fixtures/treetest/build/
tests/Fixtures/bookstore/runtime-conf.xml-e
tests/Fixtures/bookstore/runtime-conf.xml
tests/Fixtures/namespaced/runtime-conf.xml-e
tests/Fixtures/namespaced/runtime-conf.xml
tests/Fixtures/schemas/runtime-conf.xml-e
tests/Fixtures/schemas/runtime-conf.xml
vendor/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ To run unit tests, you'll have to install vendors:

Once done, build fixtures:

./tests/reset_tests.sh
php bin/propel test:prepare

Now you can run unit tests:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
# Because this file is included before the top-level build.properties file,
# you cannot refer to any properties set therein.

propel.project = bookstore-packaged
propel.database = sqlite
propel.database.url = sqlite:/var/tmp/test.db
propel.project = bookstore-packaged
propel.database = sqlite
propel.database.url = sqlite:/var/tmp/test.db
# propel.database.createUrl = (doesn't aply for SQLite, since db is auto-created)

propel.targetPackage = bookstore-packaged
propel.packageObjectModel = true
propel.targetPackage = bookstore-packaged
propel.packageObjectModel = true
propel.namespace.autoPackage = false
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
# Because this file is included before the top-level build.properties file,
# you cannot refer to any properties set therein.

propel.project = bookstore
propel.database = mysql
propel.database.url = mysql:dbname=test
propel.mysql.tableType = InnoDB
propel.disableIdentifierQuoting = true
propel.schema.autoPrefix = false
propel.project = bookstore
propel.database = ##DATABASE_VENDOR##
propel.database.url = ##DATABASE_VENDOR##:dbname=test
propel.mysql.tableType = InnoDB
propel.disableIdentifierQuoting = true
propel.schema.autoPrefix = false

# For MySQL or Oracle, you also need to specify username & password
#propel.database.user = [db username]
#propel.database.password = [db password]
propel.database.user = ##DATABASE_USER##
propel.database.password = ##DATABASE_PASSWORD##

# Note that if you do not wish to specify the database (e.g. if you
# are using multiple databses) you can use the @DB@ token which
Expand All @@ -29,7 +29,7 @@ propel.schema.autoPrefix = false

# propel.database.createUrl = (doesn't apply for SQLite, since db is auto-created)

propel.targetPackage = bookstore
propel.targetPackage = bookstore

# We need to test behavior hooks
propel.behavior.test_all_hooks.class = \Propel\Tests\Helpers\Bookstore\Behavior\Testallhooksbehavior
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,13 @@
<datasource id="bookstore">

<!-- the Propel adapter to use for this connection -->
<adapter>mysql</adapter>
<adapter>##DATABASE_VENDOR##</adapter>
<!-- Connection parameters. See PDO documentation for DSN format and available option constants. -->
<connection>
<classname>\Propel\Runtime\Connection\DebugPDO</classname>
<dsn>mysql:dbname=test</dsn>
<!--
For MySQL and Oracle you must specify username + password separate from DSN:
<user>bookstore</user>
<password></password>
-->
<dsn>##DATABASE_VENDOR##:dbname=test</dsn>
<user>##DATABASE_USER##</user>
<password>##DATABASE_PASSWORD##</password>
<options>
<option id="ATTR_PERSISTENT">false</option>
</options>
Expand All @@ -48,15 +45,12 @@
</datasource>

<datasource id="bookstore-cms">
<adapter>mysql</adapter>
<adapter>##DATABASE_VENDOR##</adapter>
<connection>
<classname>\Propel\Runtime\Connection\DebugPDO</classname>
<dsn>mysql:dbname=test</dsn>
<!--
For MySQL and Oracle you must specify username + password separate from DSN:
<user>bookstore</user>
<password></password>
-->
<dsn>##DATABASE_VENDOR##:dbname=test</dsn>
<user>##DATABASE_USER##</user>
<password>##DATABASE_PASSWORD##</password>
<options>
<option id="ATTR_PERSISTENT">false</option>
</options>
Expand All @@ -70,15 +64,12 @@
</datasource>

<datasource id="bookstore-behavior">
<adapter>mysql</adapter>
<adapter>##DATABASE_VENDOR##</adapter>
<connection>
<classname>\Propel\Runtime\Connection\DebugPDO</classname>
<dsn>mysql:dbname=test</dsn>
<!--
For MySQL and Oracle you must specify username + password separate from DSN:
<user>bookstore</user>
<password></password>
-->
<dsn>##DATABASE_VENDOR##:dbname=test</dsn>
<user>##DATABASE_USER##</user>
<password>##DATABASE_PASSWORD##</password>
<options>
<option id="ATTR_PERSISTENT">false</option>
</options>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
# Because this file is included before the top-level build.properties file,
# you cannot refer to any properties set therein.

propel.project = bookstore_namespaced
propel.database = mysql
propel.database.url = mysql:dbname=test
propel.mysql.tableType = InnoDB
propel.disableIdentifierQuoting=true
propel.project = bookstore_namespaced
propel.database = ##DATABASE_VENDOR##
propel.database.url = ##DATABASE_VENDOR##:dbname=test
propel.mysql.tableType = InnoDB
propel.disableIdentifierQuoting = true

# For MySQL or Oracle, you also need to specify username & password
#propel.database.user = [db username]
#propel.database.password = [db password]
propel.database.user = ##DATABASE_USER##
propel.database.password = ##DATABASE_PASSWORD##

# Note that if you do not wish to specify the database (e.g. if you
# are using multiple databses) you can use the @DB@ token which
Expand All @@ -28,4 +28,4 @@ propel.disableIdentifierQuoting=true

# propel.database.createUrl = (doesn't apply for SQLite, since db is auto-created)

propel.targetPackage = bookstore
propel.targetPackage = bookstore
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,13 @@
<datasource id="bookstore_namespaced">

<!-- the Propel adapter to use for this connection -->
<adapter>mysql</adapter>
<adapter>##DATABASE_VENDOR##</adapter>
<!-- Connection parameters. See PDO documentation for DSN format and available option constants. -->
<connection>
<classname>\Propel\Runtime\Connection\DebugPDO</classname>
<dsn>mysql:dbname=test</dsn>
<!--
For MySQL and Oracle you must specify username + password separate from DSN:
<user>bookstore</user>
<password></password>
-->
<dsn>##DATABASE_VENDOR##:dbname=test</dsn>
<user>##DATABASE_USER##</user>
<password>##DATABASE_PASSWORD##</password>
<options>
<option id="ATTR_PERSISTENT">false</option>
</options>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
# Because this file is included before the top-level build.properties file,
# you cannot refer to any properties set therein.

propel.project = bookstore
propel.database = mysql
propel.database.url = mysql:dbname=test
propel.mysql.tableType = InnoDB
propel.project = bookstore
propel.database = ##DATABASE_VENDOR##
propel.database.url = ##DATABASE_VENDOR##:dbname=test
propel.database.user = ##DATABASE_USER##
propel.database.password = ##DATABASE_PASSWORD##
propel.mysql.tableType = InnoDB
propel.disableIdentifierQuoting = true
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,12 @@
<datasources default="bookstore-schemas">

<datasource id="bookstore-schemas">
<adapter>mysql</adapter>
<adapter>##DATABASE_VENDOR##</adapter>
<connection>
<classname>\Propel\Runtime\Connection\DebugPDO</classname>
<dsn>mysql:dbname=test</dsn>
<!--
For MySQL and Oracle you must specify username + password separate from DSN:
<user>bookstore</user>
<password></password>
-->
<dsn>##DATABASE_VENDOR##:dbname=test</dsn>
<user>##DATABASE_USER##</user>
<password>##DATABASE_PASSWORD##</password>
<options>
<option id="ATTR_PERSISTENT">false</option>
</options>
Expand Down
49 changes: 0 additions & 49 deletions tests/reset_tests.sh

This file was deleted.

0 comments on commit c3b023f

Please sign in to comment.