/** * Set up test environment. */ public function setUp() { parent::setUp(); $this->connection = new Connection($this->link); $create_table = $this->connection->execute("CREATE TABLE `writers` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',\n `birthday` date NOT NULL,\n PRIMARY KEY (`id`)\n ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;"); $this->assertTrue($create_table); }
/** * {@inheritdoc} */ public function setUp() { parent::setUp(); $this->connection = new MysqliConnection($this->link); $this->connection->execute('DROP TABLE IF EXISTS `writers`'); $this->connection->execute("CREATE TABLE `writers` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',\n `birthday` date NOT NULL,\n PRIMARY KEY (`id`),\n KEY (`name`)\n ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;"); }
/** * Set up test environment. */ public function setUp() { parent::setUp(); $this->connection = new MysqliConnection($this->link); $create_table = $this->connection->execute("CREATE TABLE `writers` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',\n `birthday` date NOT NULL,\n PRIMARY KEY (`id`)\n ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;"); $this->assertTrue($create_table); $this->connection->execute('INSERT INTO `writers` (`name`, `birthday`) VALUES (?, ?), (?, ?), (?, ?)', 'Leo Tolstoy', new DateTime('1828-09-09'), 'Alexander Pushkin', new DateTime('1799-06-06'), 'Fyodor Dostoyevsky', new DateTime('1821-11-11')); }
/** * {@inheritdoc} */ public function setUp() { parent::setUp(); $this->connection = new MysqliConnection($this->link); $this->connection->turnOffForeignKeyChecks(); $this->connection->execute('DROP TABLE IF EXISTS `periods`'); $this->connection->execute("CREATE TABLE `periods` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',\n PRIMARY KEY (`id`)\n ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;"); $this->connection->execute('DROP TABLE IF EXISTS `topics`'); $this->connection->execute("CREATE TABLE `topics` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',\n PRIMARY KEY (`id`)\n ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;"); $this->connection->execute('DROP TABLE IF EXISTS `writers`'); $this->connection->execute("CREATE TABLE `writers` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `period_id` int(11) NOT NULL DEFAULT '0',\n `topic_id` int(11) NOT NULL DEFAULT '0',\n `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',\n `birthday` date NOT NULL,\n PRIMARY KEY (`id`),\n KEY (`name`),\n CONSTRAINT `writer_period` FOREIGN KEY (`period_id`) REFERENCES `periods`(`id`),\n CONSTRAINT `writer_topic` FOREIGN KEY (`topic_id`) REFERENCES `topics`(`id`)\n ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;"); $this->connection->turnOnForeignKeyChecks(); }
/** * Set up test environment. */ public function setUp() { parent::setUp(); $this->connection = new MysqliConnection($this->link); }