testcontainers_magento_data/
lib.rs

1#![allow(async_fn_in_trait)]
2//! # 🐳 Test-Containers for Quick Magento Development
3//!
4//! Allows to quickly spin up ready to use data containers with pre-build Magento configurations
5//!
6//! ## Magento 2.4.7-p3 with Sample Data
7//!
8//! Here is a quick example of the test with MySQL container with sample data for 2.4.7-p3 release
9//!
10//! ```rust
11//! use sqlx::mysql::MySqlPool;
12//! use testcontainers::runners::AsyncRunner;
13//! use testcontainers_magento_data::core::ImageBuilder;
14//! use testcontainers_magento_data::images::{DbContainer, DbConnection};
15//!
16//! #[tokio::test]
17//! async fn starts_container_with_sample_data() {
18//!     let container = DbContainer::mysql()
19//!         .with_sample_data()
20//!         .with_version("2.4.7-p3")
21//!         .start().await.unwrap();
22//!
23//!
24//!     let connection = MySqlPool::connect(
25//!         &container.connection_url().await.unwrap()
26//!     ).await.unwrap();
27//!
28//!     let total: i64 = sqlx::query_scalar(
29//!         "SELECT COUNT(*) FROM catalog_product_entity"
30//!     ).fetch_one(&connection).await.unwrap();
31//!
32//!     assert_eq!(total, 2040);
33//! }
34//! ```
35pub mod core;
36pub mod images;
37pub mod runners;