From d19932eccdc4501d67d0d3e22b684e4be363094c Mon Sep 17 00:00:00 2001 From: Brandon Shipley Date: Sat, 14 Feb 2026 01:08:57 -0800 Subject: [PATCH] upgrade migrations plugin to 4.5 to fix base migratino not found error on setup-lowest tests --- composer.json | 2 +- .../Component/ShoppingCartComponentTest.php | 2 +- tests/bootstrap.php | 7 ++- tests/schema.sql | 60 ------------------- 4 files changed, 6 insertions(+), 65 deletions(-) delete mode 100644 tests/schema.sql diff --git a/composer.json b/composer.json index ae94cd2..de425f6 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ }, "require-dev": { "phpunit/phpunit": "^10.3", - "cakephp/migrations": "^4.0.0", + "cakephp/migrations": "^4.5.0", "phpstan/phpstan": "^2.1", "dereuromark/composer-prefer-lowest": "^0.1.10", "cakedc/cakephp-phpstan": "^4.1", diff --git a/tests/TestCase/Controller/Component/ShoppingCartComponentTest.php b/tests/TestCase/Controller/Component/ShoppingCartComponentTest.php index e8a06ee..2826a78 100644 --- a/tests/TestCase/Controller/Component/ShoppingCartComponentTest.php +++ b/tests/TestCase/Controller/Component/ShoppingCartComponentTest.php @@ -108,7 +108,7 @@ class ShoppingCartComponentTest extends TestCase { */ public function testCheckIfIsOwnCartIsNotOwnCart() { $this->expectException(RecordNotFoundException::class); - $cart = $this->fetchTable('Carts')->get('00e6ec6b-eef8-429c-9196-e7e0668ba749'); + $cart = $this->fetchTable('Carts')->get('74d1aa54-92a2-4039-bc10-61e1190c51ec'); $this->component->checkIfIsOwnCart($cart); // if exception not thrown test fails } diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 456de44..738c135 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -9,6 +9,7 @@ use Cake\Database\Connection; use Cake\Datasource\ConnectionManager; use Cake\TestSuite\Fixture\SchemaLoader; use CakeCarts\CakeCartsPlugin; +use Migrations\TestSuite\Migrator; use TestApp\Controller\AppController; if (!defined('DS')) { @@ -120,7 +121,7 @@ ConnectionManager::setConfig('test', [ * and using \Migrations\TestSuite\Migrator to load schema. */ // Load a schema dump file. -(new SchemaLoader())->loadSqlFiles('tests/schema.sql', 'test'); +//(new SchemaLoader())->loadSqlFiles('tests/schema.sql', 'test'); -//$migrator = new Migrator(); -//$migrator->run(['plugin' => 'CakeCarts']); +$migrator = new Migrator(); +$migrator->run(['plugin' => 'CakeCarts']); diff --git a/tests/schema.sql b/tests/schema.sql deleted file mode 100644 index 3a87e79..0000000 --- a/tests/schema.sql +++ /dev/null @@ -1,60 +0,0 @@ --- --- Table structure for table `cart_items` --- - -DROP TABLE IF EXISTS `cart_items`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8mb4 */; -CREATE TABLE `cart_items` ( - `id` char(36) NOT NULL, - `foreign_key` int(11) DEFAULT NULL, - `foreign_key_uuid` char(36) DEFAULT NULL, - `model` varchar(255) NOT NULL, - `cart_id` char(36) NOT NULL, - `position` int(11) DEFAULT NULL, - `qty` int(11) NOT NULL, - `price` decimal(13,5) DEFAULT NULL, - `subtotal` decimal(13,5) DEFAULT NULL, - PRIMARY KEY (`id`) -); -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `cart_items` --- - -/*!40000 ALTER TABLE `cart_items` DISABLE KEYS */; -INSERT INTO `cart_items` VALUES ('08c9b023-a10d-4562-aea4-c64d357a1867',NULL,'3a477e3e-7977-4813-81f6-f85949613979','ProductSkus','00e6ec6b-eef8-429c-9196-e7e0668ba749',NULL,5,4.00000,20.00000),('11b6ef27-cabc-4afa-bae9-9644394c8b04',NULL,'a33a318f-84a8-48e4-aeff-b02afedfc91e','ProductSkus','d2928d3a-ea44-43b4-adaf-68f5f7924575',NULL,6,25.00000,150.00000),('32bce9d1-6602-4159-908e-ec6cd04181d6',NULL,'a302979b-bab0-49c8-8d3c-22118cf4e45b','ProductSkus','c1ced6bb-9d26-4882-ae74-444a834694cf',NULL,1,0.27400,0.27400),('60d28742-3d3f-4473-b381-8d56f75d9d12',NULL,'a33a318f-84a8-48e4-aeff-b02afedfc91e','ProductSkus','eb76c4e9-ba33-4f92-a160-a7c76dc9c0ed',NULL,2,1500.00000,3000.00000),('64e7ea02-cb89-41c9-9524-2edeff70515e',NULL,'a302979b-bab0-49c8-8d3c-22118cf4e45b','ProductSkus','c1ced6bb-9d26-4882-ae74-444a834694cf',NULL,51,0.27400,13.97400),('9f140892-654e-430c-871a-bb0402fa1689',NULL,'a33a318f-84a8-48e4-aeff-b02afedfc91e','ProductSkus','d2928d3a-ea44-43b4-adaf-68f5f7924575',NULL,1,NULL,0.00000); -/*!40000 ALTER TABLE `cart_items` ENABLE KEYS */; - --- --- Table structure for table `carts` --- - -DROP TABLE IF EXISTS `carts`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8mb4 */; -CREATE TABLE `carts` ( - `id` char(36) NOT NULL, - `cart_type_id` int(11) NOT NULL, - `session_id` varchar(255) DEFAULT NULL, - `user_id` int(11) DEFAULT NULL, - `user_id_uuid` char(36) DEFAULT NULL, - `created` datetime NOT NULL, - `modified` datetime DEFAULT NULL, - `deleted` datetime DEFAULT NULL, - `removed` datetime DEFAULT NULL, - `removed_reason_id` int(11) DEFAULT NULL, - `num_items` int(11) NOT NULL DEFAULT 0, - PRIMARY KEY (`id`) -); -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `carts` --- - -/*!40000 ALTER TABLE `carts` DISABLE KEYS */; -INSERT INTO `carts` VALUES ('00e6ec6b-eef8-429c-9196-e7e0668ba749',1,'40dbg7dq7t0a0kfl4ie29qa0r3',NULL,NULL,'2025-10-17 07:24:53','2025-10-17 07:24:53',NULL,NULL,NULL,0),('8f9ba579-84da-45a3-a23e-d4004eb17556',1,'9ustc5jbksfk2kn29t1r8ss4bi',NULL,NULL,'2025-11-02 01:41:32','2025-11-02 01:41:32',NULL,NULL,NULL,0),('980c731d-e543-43f8-a81e-bb2195f5783e',1,'d1c372spbgqm4236mlhmmetc0g',NULL,NULL,'2025-11-02 06:04:48','2025-11-02 06:04:48',NULL,NULL,NULL,0),('c1ced6bb-9d26-4882-ae74-444a834694cf',1,'lm091irggg9g4hoifgdbt9egj2',NULL,NULL,'2025-10-17 06:36:41','2025-10-17 06:36:41',NULL,NULL,NULL,0),('d2928d3a-ea44-43b4-adaf-68f5f7924575',1,'ueue6lvqrrbq913kg09momkddn',NULL,NULL,'2025-10-12 05:19:03','2025-10-12 05:19:03',NULL,NULL,NULL,0),('eb76c4e9-ba33-4f92-a160-a7c76dc9c0ed',1,'gt0c5hc8qutbg9d0mq5po6i1at',NULL,NULL,'2025-10-14 08:06:51','2025-10-14 08:06:51',NULL,NULL,NULL,0); -/*!40000 ALTER TABLE `carts` ENABLE KEYS */; -