2006-11-22 03:26:34 +03:00
|
|
|
<?php
|
2007-01-12 01:58:28 +03:00
|
|
|
/*
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
* This software consists of voluntary contributions made by many individuals
|
|
|
|
* and is licensed under the LGPL. For more information, see
|
|
|
|
* <http://www.phpdoctrine.com>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Doctrine_Export_TestCase
|
|
|
|
*
|
|
|
|
* @package Doctrine
|
|
|
|
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
|
|
|
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
|
|
|
* @category Object Relational Mapping
|
|
|
|
* @link www.phpdoctrine.com
|
|
|
|
* @since 1.0
|
|
|
|
* @version $Revision$
|
|
|
|
*/
|
2007-02-12 01:55:19 +03:00
|
|
|
class Doctrine_Export_TestCase extends Doctrine_UnitTestCase
|
|
|
|
{
|
|
|
|
public function testCreateTableThrowsExceptionWithoutValidTableName()
|
|
|
|
{
|
2006-11-22 03:26:34 +03:00
|
|
|
try {
|
2006-11-24 02:23:24 +03:00
|
|
|
$this->export->createTable(0, array(), array());
|
2006-11-22 03:26:34 +03:00
|
|
|
|
|
|
|
$this->fail();
|
|
|
|
} catch(Doctrine_Export_Exception $e) {
|
|
|
|
$this->pass();
|
|
|
|
}
|
|
|
|
}
|
2007-02-12 01:55:19 +03:00
|
|
|
public function testCreateTableThrowsExceptionWithEmptyFieldsArray()
|
|
|
|
{
|
2006-11-22 03:26:34 +03:00
|
|
|
try {
|
2006-11-24 02:23:24 +03:00
|
|
|
$this->export->createTable('sometable', array(), array());
|
2006-11-22 03:26:34 +03:00
|
|
|
|
|
|
|
$this->fail();
|
|
|
|
} catch(Doctrine_Export_Exception $e) {
|
|
|
|
$this->pass();
|
|
|
|
}
|
|
|
|
}
|
2007-02-12 01:55:19 +03:00
|
|
|
public function testDropConstraintExecutesSql()
|
|
|
|
{
|
2006-11-23 02:35:34 +03:00
|
|
|
$this->export->dropConstraint('sometable', 'relevancy');
|
2006-12-28 00:20:26 +03:00
|
|
|
|
2007-10-20 18:57:47 +04:00
|
|
|
$this->assertEqual($this->adapter->pop(), 'ALTER TABLE sometable DROP CONSTRAINT relevancy');
|
2006-11-23 02:35:34 +03:00
|
|
|
}
|
2007-02-12 01:55:19 +03:00
|
|
|
public function testCreateIndexExecutesSql()
|
|
|
|
{
|
2006-11-22 03:26:34 +03:00
|
|
|
$this->export->createIndex('sometable', 'relevancy', array('fields' => array('title' => array(), 'content' => array())));
|
|
|
|
|
2006-12-28 00:20:26 +03:00
|
|
|
$this->assertEqual($this->adapter->pop(), 'CREATE INDEX relevancy_idx ON sometable (title, content)');
|
2006-11-22 03:26:34 +03:00
|
|
|
}
|
|
|
|
|
2007-02-12 01:55:19 +03:00
|
|
|
public function testDropIndexExecutesSql()
|
|
|
|
{
|
2006-11-22 03:26:34 +03:00
|
|
|
$this->export->dropIndex('sometable', 'relevancy');
|
|
|
|
|
2006-11-29 02:26:44 +03:00
|
|
|
$this->assertEqual($this->adapter->pop(), 'DROP INDEX relevancy_idx');
|
2006-11-22 03:26:34 +03:00
|
|
|
}
|
2007-02-12 01:55:19 +03:00
|
|
|
public function testDropTableExecutesSql()
|
|
|
|
{
|
2006-11-22 03:26:34 +03:00
|
|
|
$this->export->dropTable('sometable');
|
|
|
|
|
|
|
|
$this->assertEqual($this->adapter->pop(), 'DROP TABLE sometable');
|
|
|
|
}
|
2007-02-12 01:55:19 +03:00
|
|
|
public function testRecordIsExportedProperly()
|
|
|
|
{
|
|
|
|
|
2007-04-11 23:12:52 +04:00
|
|
|
}
|
|
|
|
public function testExport()
|
|
|
|
{
|
2007-06-12 23:42:27 +04:00
|
|
|
|
2007-01-12 01:58:28 +03:00
|
|
|
}
|
2006-11-22 03:26:34 +03:00
|
|
|
}
|