承接 ecomdev/testcontainers-magento-data 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ecomdev/testcontainers-magento-data

Composer 安装命令:

composer require ecomdev/testcontainers-magento-data

包简介

TestContainers for Magento data in integration/functional tests

README 文档

README

Docker Build PHP Package

This package simplifies the process of automated testing with real database and search engine

✨ Features

  • 📦 Pre-configured database and search containers: Instantly spin up containers with ready-to-use Magento data
  • ⚙️ Easy setup and use: Use PHP package to automatically discard container after tests
  • 🎯 Blazingly Fast: Container takes only few seconds to start, so you can focus on testing instead of waiting for db initialization

📋 Requirements

  • 🐳 Docker: Ensure Docker is installed and operational on your system.

📦 Available images

All the available Docker image version can be found in build repository EcomDev/testcontainer-magento-data

Installation

Use composer with --dev flag to add it as dependency for your tests

composer require --dev ecomdev/testcontainers-magento-data

Examples

MySQL container

Create Latest Magento Database Build

use EcomDev\TestContainers\MagentoData\DbContainerBuilder;

$container = DbContainerBuilder::mysql()
    ->build();

Create Latest Magento Database Build with sample data

use EcomDev\TestContainers\MagentoData\DbContainerBuilder;

$container = DbContainerBuilder::mysql()
    ->withSampleData()
    ->build();

Create 2.4.7-p2 with sample data and fetch number of products

use EcomDev\TestContainers\MagentoData\DbContainerBuilder;
use PDO;

$container = DbContainerBuilder::mysql()
    ->withMagentoVersion('2.4.7-p2')
    ->withSampleData()
    ->build();

$connectionSettings = $container->getConnectionSettings();
$connection = new PDO(
    $connectionSettings->dsn(),
    $connectionSettings->user,
    $connectionSettings->password
);

$result = $connection->query('SELECT COUNT(*) FROM catalog_product_entity');
// Outputs 2040
echo $result->fetch(PDO::FETCH_COLUMN);

MariaDB container

Everything the same as for MySQL container, just a different builder method

use EcomDev\TestContainers\MagentoData\DbContainerBuilder;

$container = DbContainerBuilder::mariadb()
    ->withMagentoVersion('2.4.7-p2')
    ->withSampleData()
    ->build();

OpenSearch container

For OpenSearch container there is a different builder and container, that allows building base url for http connection

Here is a small example

use EcomDev\TestContainers\MagentoData\OpenSearchContainerBuilder;
use GuzzleHttp\Client;

$container = OpenSearchContainerBuilder::new()
            ->withSampleData()
            ->build();

$client = new Client([
    'base_uri' => $container->getBaseUrl()
]);

$result = json_decode(
    $client->get('magento2_product_1/_count')->getBody()->getContents(),
    true
);

// Outputs 181
echo $result['count'];

📜 License

This project is licensed under the MIT License.

See the LICENSE file for more details.

ecomdev/testcontainers-magento-data 适用场景与选型建议

ecomdev/testcontainers-magento-data 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 442 次下载、GitHub Stars 达 4, 最近一次更新时间为 2025 年 01 月 07 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 ecomdev/testcontainers-magento-data 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 ecomdev/testcontainers-magento-data 我们能提供哪些服务?
定制开发 / 二次开发

基于 ecomdev/testcontainers-magento-data 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 442
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 15
  • 依赖项目数: 2
  • 推荐数: 1

GitHub 信息

  • Stars: 4
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-01-07