jhartlep (3) [Avatar] Offline
I have a problem using phpunit on Chapter 3.
Instead of MySQL, I'm using SQLite on my local machine.

Using this code:
$db = sqlite_open('../db/places_test.db');
$res = sqlite_query($db,'select * from places');

gives me the three places from my db.
But using "phpunit models_PlaceTest" I get this error:

There was 1 error:

1) models_PlacesTest::testFetchAll
Zend_Db_Adapter_Exception: SQLSTATE[HY000] [14] unable to open database file


Tests: 1, Assertions: 0, Errors: 1.

Here is my config.ini:
db.adapter = PDO_SQLITE
db.params.dbname = APPLICATION_PATH "/../db/places.db"
date_default_timezone = "Europe/Berlin"

[live : general]

[dev : general]

[test : general]
db.params.dbname = APPLICATION_PATH "/../db/places_test.db"

I hope you can help me with this... - without changing to mysql...
akrabat (479) [Avatar] Offline
Re: ZFiA - Chapter3 - SQLite
I would check that the path is correct.

What path do you get when you dump out realpath(APPLICATION_PATH . "/../db/places_test.db") and does a file exist there?


jhartlep (3) [Avatar] Offline
Re: ZFiA - Chapter3 - SQLite
Got it. Thanks for the hint...
I forgot to define APPLICATION_PATH... :S ...