| Crates.io | testcontainers-magento-data |
| lib.rs | testcontainers-magento-data |
| version | 0.1.0 |
| created_at | 2025-01-07 15:36:23.986736+00 |
| updated_at | 2025-01-07 15:36:23.986736+00 |
| description | 🐳 Test-Containers for Quick Magento Development |
| homepage | |
| repository | https://github.com/ecomdev/testcontainer-magento-data-rust |
| max_upload_size | |
| id | 1507333 |
| size | 27,367 |
This package simplifies the process of automated testing with real database and search engine
All the available Docker image version can be found in build repository EcomDev/testcontainer-magento-data
Use cargo with --dev flag to add it as dependency for your tests
cargo add --dev testcontainers-magento-data
Run queries against Magento database build with sample data
use sqlx::MySqlPool;
use testcontainers_magento_data::runners::AsyncRunner;
use testcontainers_magento_data::core::ImageBuilder;
use testcontainers_magento_data::images::{DbConnection, DbContainer};
#[tokio::test]
async fn starts_container_with_sample_data() {
let container = DbContainer::mariadb()
.with_sample_data()
.with_version("2.4.7-p2")
.start()
.await
.unwrap();
let connection = MySqlPool::connect(&container.connection_url().await.unwrap())
.await
.unwrap();
let total: i64 = sqlx::query_scalar("SELECT COUNT(*) FROM catalog_product_entity")
.fetch_one(&connection)
.await
.unwrap();
assert_eq!(total, 2040);
}
This project is licensed under the MIT License.
See the LICENSE file for more details.