| 54 | | |
| 55 | | public function testImportSingularizeOn() |
| 56 | | { |
| 57 | | $this->dbh = new PDO('sqlite::memory:'); |
| 58 | | |
| 59 | | $this->dbh->exec('CREATE TABLE imports_tests_users (id INTEGER PRIMARY KEY, name TEXT)'); |
| 60 | | |
| 61 | | $this->conn = Doctrine_Manager::connection($this->dbh, 'tmp1234'); |
| 62 | | $this->conn->setAttribute(Doctrine::ATTR_SINGULARIZE_IMPORT, true); |
| 63 | | $this->conn->import->importSchema('Import/_files', array('tmp1234')); |
| 64 | | |
| 65 | | $this->assertTrue(file_exists('Import/_files/ImportTestUser.php')); |
| 66 | | $this->assertTrue(file_exists('Import/_files/generated/BaseImportTestUser.php')); |
| 67 | | Doctrine_Lib::removeDirectories('Import/_files'); |
| 68 | | } |
| 69 | | |
| 70 | | public function testImportSingularizeOff() |
| 71 | | { |
| 72 | | $this->dbh = new PDO('sqlite::memory:'); |
| 73 | | |
| 74 | | $this->dbh->exec('CREATE TABLE imports_tests_users (id INTEGER PRIMARY KEY, name TEXT)'); |
| 75 | | |
| 76 | | $this->conn = Doctrine_Manager::connection($this->dbh, 'tmp1235'); |
| 77 | | $this->conn->setAttribute(Doctrine::ATTR_SINGULARIZE_IMPORT, false); |
| 78 | | $this->conn->import->importSchema('Import/_files', array('tmp1235')); |
| 79 | | |
| 80 | | $this->assertTrue(file_exists('Import/_files/ImportsTestsUsers.php')); |
| 81 | | $this->assertTrue(file_exists('Import/_files/generated/BaseImportsTestsUsers.php')); |
| 82 | | Doctrine_Lib::removeDirectories('Import/_files'); |
| 83 | | } |