Skip to content

Commit 05f4bcb

Browse files
committed
Release version 0.0.13
1 parent 8acd3c8 commit 05f4bcb

19 files changed

Lines changed: 4951 additions & 339 deletions

.github/workflows/tests.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Run Plugin Tests
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
branches:
8+
- main
9+
10+
jobs:
11+
test:
12+
runs-on: ubuntu-latest
13+
14+
services:
15+
mysql:
16+
image: mysql:5.7
17+
env:
18+
MYSQL_ROOT_PASSWORD: "#dgs45As"
19+
MYSQL_DATABASE: wp_test
20+
MYSQL_USER: wp_test
21+
MYSQL_PASSWORD: "#dgs45As"
22+
ports:
23+
- 3306:3306
24+
options: --health-cmd="mysqladmin ping --silent" --health-interval=10s --health-timeout=5s --health-retries=3
25+
26+
steps:
27+
- name: Checkout code
28+
uses: actions/checkout@v2
29+
30+
- name: Set up PHP
31+
uses: shivammathur/setup-php@v2
32+
with:
33+
php-version: '8.1'
34+
extensions: mbstring, dom, curl
35+
tools: composer, phpunit
36+
37+
- name: Install dependencies
38+
run: |
39+
composer install --no-interaction --prefer-dist
40+
41+
- name: Set environment variables
42+
run: |
43+
echo "WP_TEST__DIR=$(pwd)" >> $GITHUB_ENV
44+
45+
- name: Download and Extract WooCommerce
46+
run: |
47+
curl -o woocommerce.zip https://downloads.wordpress.org/plugin/woocommerce.10.2.2.zip
48+
unzip woocommerce.zip
49+
mv woocommerce ..
50+
51+
- name: Run tests
52+
run: vendor/bin/phpunit --testdox

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/vendor/
2+
/wordpress/
3+
/node_modules
4+
.env
5+
.phpunit.result.cache

Makefile

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Variables de configuración
2+
WP_TEST__DIR := ../../wp-tests
3+
TEST_UNIT := ${WP_TEST__DIR}/vendor/bin/phpunit
4+
TESTS_DIR := tests
5+
6+
# Colores para output
7+
GREEN := \033[0;32m
8+
YELLOW := \033[1;33m
9+
NC := \033[0m # No Color
10+
11+
.PHONY: test test-calculate-dv test-invoice test-client test-all help
12+
13+
# Ayuda
14+
help:
15+
@echo "$(YELLOW)Comandos disponibles:$(NC)"
16+
@echo " $(GREEN)make test$(NC) - Ejecutar todos los tests"
17+
@echo " $(GREEN)make test-calculate-dv$(NC) - Tests de calculate_dv"
18+
@echo " $(GREEN)make test-invoice$(NC) - Tests de Invoice Generation"
19+
@echo " $(GREEN)make test-client$(NC) - Tests de Client Management"
20+
@echo " $(GREEN)make test-all$(NC) - Todos los tests con detalles"
21+
22+
# Ejecutar todos los tests
23+
test:
24+
@echo "$(YELLOW)Ejecutando todos los tests...$(NC)"
25+
WP_TEST__DIR=${WP_TEST__DIR} ${TEST_UNIT} --testdox --colors=always
26+
27+
# Tests de calculate_dv
28+
test-calculate-dv:
29+
@echo "$(YELLOW)Ejecutando tests de calculate_dv...$(NC)"
30+
WP_TEST__DIR=${WP_TEST__DIR} ${TEST_UNIT} --filter Test_Integration_Alegra_WC --testdox --colors=always
31+
32+
# Tests de Invoice Generation
33+
test-invoice:
34+
@echo "$(YELLOW)Ejecutando tests de Invoice Generation...$(NC)"
35+
WP_TEST__DIR=${WP_TEST__DIR} ${TEST_UNIT} --filter Test_Invoice_Generation --testdox --colors=always
36+
37+
# Tests de Client Management
38+
test-client:
39+
@echo "$(YELLOW)Ejecutando tests de Client Management...$(NC)"
40+
WP_TEST__DIR=${WP_TEST__DIR} ${TEST_UNIT} --filter Test_Client_Management --testdox --colors=always
41+
42+
# Todos los tests con detalles
43+
test-all:
44+
@echo "$(YELLOW)Ejecutando todos los tests con detalles...$(NC)"
45+
WP_TEST__DIR=${WP_TEST__DIR} ${TEST_UNIT} --colors=always

composer.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "saulmoralespa/integration-alegra-woo",
3+
"description": "Integration Alegra Woocommerce",
4+
"license": "MIT",
5+
"authors": [
6+
{
7+
"name": "Saúl Morales Pacheco",
8+
"email": "moralespachecopablo@gmail.com"
9+
}
10+
],
11+
"require": {
12+
"roots/wordpress": "^6.0"
13+
},
14+
"config": {
15+
"allow-plugins": {
16+
"roots/wordpress-core-installer": true,
17+
"dealerdirect/phpcodesniffer-composer-installer": true
18+
}
19+
},
20+
"require-dev": {
21+
"phpunit/phpunit": "^9.0",
22+
"wp-phpunit/wp-phpunit": "^6.0",
23+
"yoast/phpunit-polyfills": "^1.0",
24+
"squizlabs/php_codesniffer": "^3.7",
25+
"wp-coding-standards/wpcs": "^3.0",
26+
"phpcompatibility/phpcompatibility-wp": "^2.1",
27+
"dealerdirect/phpcodesniffer-composer-installer": "^1.0"
28+
},
29+
"scripts": {
30+
"test": "phpunit",
31+
"phpcs": "phpcs --standard=WordPress --extensions=php --ignore=vendor,node_modules .",
32+
"phpcbf": "phpcbf --standard=WordPress --extensions=php --ignore=vendor,node_modules .",
33+
"phpcs-check": "phpcs --standard=WordPress includes/"
34+
}
35+
}

0 commit comments

Comments
 (0)