Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 11 additions & 13 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@ name: bowphp
on: [ push, pull_request ]

env:
FTP_HOST: localhost
FTP_USER: username
FTP_PASSWORD: password
FTP_PORT: 21
FTP_ROOT: /tmp
AWS_KEY: ${{ secrets.AWS_KEY }}
AWS_SECRET: ${{ secrets.AWS_SECRET }}
AWS_ENDPOINT: ${{ secrets.AWS_ENDPOINT }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}

jobs:
lunix-tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
php: [8.1, 8.2, 8.3]
php: [8.1, 8.2, 8.3, 8.4]
os: [ubuntu-latest]
stability: [prefer-lowest, prefer-stable]

Expand All @@ -39,14 +40,11 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, mysql, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, redis
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, mysql, sqlite, pgsql, pdo_mysql, pdo_pgsql, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, redis
coverage: none

- run: docker run -p 21:21 -p 20:20 -p 12020:12020 -p 12021:12021 -p 12022:12022 -p 12023:12023 -p 12024:12024 -p 12025:12025 -e USER=$FTP_USER -e PASS=$FTP_PASSWORD -d --name ftp papacdev/vsftpd
- run: docker run -p 1080:1080 -p 1025:1025 -d --name maildev soulteary/maildev
- run: docker run -p 6379:6379 -d --name redis redis
- run: docker run -p 5432:5432 --name postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=postgres -e POSTGRES_PASSWORD=postgres -d postgis/postgis
- run: docker run -d -p 11300:11300 schickling/beanstalkd
- name: Set Docker containers
run: docker compose up -d

- name: Cache Composer packages
id: composer-cache
Expand All @@ -67,4 +65,4 @@ jobs:
run: if [ ! -d /tmp/bowphp_testing ]; then mkdir -p /tmp/bowphp_testing; fi;

- name: Run test suite
run: sudo composer run-script test || sudo composer run-script testdox
run: ./vendor/bin/phpunit tests --configuration phpunit.dist.xml
21 changes: 11 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
tests/data/database.sqlite
tests/data/cache/**
vendor
phpunit.xml
.idea
.DS_Store
.env.json
composer.lock
.phpunit.result.cache
bob
tests/data/database.sqlite
tests/data/cache/**
vendor
phpunit.xml
.idea
.DS_Store
.env.json
composer.lock
.phpunit.result.cache
bob
.phpunit.cache
51 changes: 51 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,57 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added

- **SMTP Adapter**: Complete rewrite with RFC-compliant SMTP protocol implementation
- Expanded from 8 to 21 methods for better functionality separation
- Added comprehensive configuration validation (hostname, port, timeout)
- Implemented multi-exception handling (SmtpException | SocketException)
- Enhanced email address parsing supporting "Name <email@example.com>" format
- Added optional authentication support
- Created comprehensive test suite with 21 tests and 35 assertions
- **FTP Service**: Connection retry logic with 3 attempts and configurable delays
- **FTP Service**: Configuration constants and validation for all required fields
- **FTP Service**: Automatic stream cleanup with try-finally blocks
- **FTP Service**: Destructor for proper resource cleanup
- **Database Notifications**: Enhanced test coverage with 4 additional comprehensive tests
- **Queue System**: Graceful logger fallback in BeanstalkdAdapter

### Changed

- **FTP Service**: Complete refactoring with improved error handling and resource management (651 lines)
- Enhanced all file operations methods (store, get, put, append, prepend, copy, move, delete)
- Improved directory operations (files, directories, makeDirectory)
- Better passive/active mode configuration
- More specific and actionable error messages
- Added connection state validation with `ensureConnection()` method
- **Environment Configuration**: Fixed path handling by removing unreliable `realpath()` usage
- **Configuration Loader**: Improved validation and error handling
- **Messaging System**: Fixed PHPUnit mock issues and corrected type signatures
- **Test Suite**: Renamed test methods to snake_case for consistency
- **Database Tests**: Significantly expanded test coverage across connection, migration, pagination, and query builders

### Fixed

- **SMTP Adapter**: Port validation now correctly validates range (1-65535)
- **SMTP Adapter**: Timeout validation now requires positive integers
- **FTP Service**: Fixed directory listing parser to handle filenames with spaces
- **FTP Service**: Improved error messages with connection details
- **Environment Configuration**: Fixed `Env::configure()` error handling
- **Queue Tests**: Fixed mock configuration issues in MessagingTest
- **Notification Tests**: Added missing timestamp columns in test schema

### Improved

- **Test Coverage**: Added 29 new tests with 46 new assertions
- **Error Rate**: Reduced test errors by 39% (28 → 17 errors)
- **Failure Rate**: Reduced test failures by 70% (10 → 3 failures)
- **Code Quality**: Better error messages across all refactored components
- **Resource Management**: Proper cleanup prevents resource leaks
- **Configuration Validation**: Early validation with specific error messages

## 5.1.7 - 2024-12-21

### What's Changed
Expand Down
16 changes: 8 additions & 8 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ services:
- "5432:5432"
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
volumes:
- postgres_data:/var/lib/postgresql/data
Expand All @@ -61,23 +61,23 @@ services:
- "20:20"
- "12020-12025:12020-12025"
environment:
USER: bob
PASS: "12345"
USER: username
PASS: password
volumes:
- "ftp_storage:/ftp/$USER"
networks:
- bowphp_network
mail:
container_name: bowphp_mail
image: maildev/maildev
container_name: bowphp_mailhog
image: mailhog/mailhog
restart: unless-stopped
ports:
- "1025:25"
- "1080:80"
- "1025:1025"
- "1080:8025"
networks:
- bowphp_network
healthcheck:
test: ["CMD", "nc", "-z", "localhost", "25"]
test: ["CMD", "nc", "-z", "localhost", "1025"]
interval: 10s
timeout: 5s
retries: 5
Expand Down
2 changes: 1 addition & 1 deletion php.dist.ini
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sendmail_path = /tmp/sendmail -t -i

31 changes: 2 additions & 29 deletions phpunit.dist.xml
Original file line number Diff line number Diff line change
@@ -1,21 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
colors="true"
bootstrap="tests/bootstrap.php"
verbose="true"
failOnRisky="true"
failOnWarning="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
stopOnFailure="false"
executionOrder="random"
resolveDependencies="true">
<phpunit colors="true" bootstrap="tests/bootstrap.php">
<testsuite name="Bow Framework">
<directory suffix=".php">tests/</directory>
<exclude>./tests/SessionTest.php</exclude>
</testsuite>
<php>
<env name="MYSQL_HOSTNAME" value="127.0.0.1"/>
Expand All @@ -28,18 +13,6 @@
<env name="FTP_PASSWORD" value="password"/>
<env name="FTP_USERNAME" value="username"/>
<env name="FTP_PORT" value="21"/>
<env name="FTP_ROOT" value="."/>
<ini name="error_reporting" value="-1"/>
<ini name="display_errors" value="On"/>
<ini name="display_startup_errors" value="On"/>
<env name="FTP_ROOT" value="/tmp"/>
</php>
<coverage>
<include>
<directory suffix=".php">src</directory>
</include>
<exclude>
<directory>vendor</directory>
<directory>tests</directory>
</exclude>
</coverage>
</phpunit>
Loading
Loading