Skip to content
Extraits de code Groupes Projets
SqlTest.php 1,26 ko
Newer Older
  • Learn to ignore specific revisions
  •  * Piwik - free/libre analytics platform
    
     *
     * @link http://piwik.org
     * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
    
     */
    
    namespace Piwik\Tests\Integration;
    
    use Piwik\Db;
    use Piwik\Tests\Framework\TestCase\IntegrationTestCase;
    
    /**
    
    class SqlTest extends IntegrationTestCase
    
        public function setUp()
        {
            parent::setUp();
    
            // create two myisam tables
    
            Db::exec("CREATE TABLE table1 (a INT) ENGINE=MYISAM");
            Db::exec("CREATE TABLE table2 (b INT) ENGINE=MYISAM");
    
            Db::exec("CREATE TABLE table3 (c INT) ENGINE=InnoDB");
            Db::exec("CREATE TABLE table4 (d INT) ENGINE=InnoDB");
    
        }
    
        public function tearDown()
        {
            parent::tearDown();
        }
    
    
        public function testOptimize()
        {
    
            // make sure optimizing myisam tables works
    
            $this->assertTrue(Db::optimizeTables(array('table1', 'table2')) !== false);
    
    
            // make sure optimizing both myisam & innodb results in optimizations
    
            $this->assertTrue(Db::optimizeTables(array('table1', 'table2', 'table3', 'table4')) !== false);
    
    
            // make sure innodb tables are skipped
    
            $this->assertTrue(Db::optimizeTables(array('table3', 'table4')) === false);