Skip to content
Merged

Wip #80

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
63 changes: 63 additions & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: PHPUnit

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_dispatch:

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4' # ← Changed from '8.3' to '8.4'
extensions: xdebug
coverage: xdebug # ← Explicitly enable coverage driver

- name: Validate composer.json and composer.lock
run: composer validate --strict

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-

- name: Install dependencies
run: composer install --prefer-dist --no-progress

- name: Download PHPUnit PHAR
run: |
wget https://phar.phpunit.de/phpunit.phar
chmod +x phpunit.phar
mv phpunit.phar /usr/local/bin/phpunit

- name: Check PHPUnit version
run: phpunit --version

- name: Run PHPUnit tests with coverage
run: |
mkdir -p build/logs
phpunit --configuration phpunit.xml --coverage-clover build/logs/clover.xml --debug
env:
XDEBUG_MODE: coverage

- name: Send coverage to Coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: build/logs/clover.xml
3 changes: 2 additions & 1 deletion .gitignore
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
/vendor/
/composer.lock
/.phpunit.cache/
/.phpunit.result.cache
/.phpunit.result.cache
/nbproject/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status](https://travis-ci.org/Jagepard/Rudra-Model.svg?branch=master)](https://travis-ci.org/Jagepard/Rudra-Model)
[![PHPunit](https://github.com/Jagepard/Rudra-Model/actions/workflows/php.yml/badge.svg)](https://github.com/Jagepard/Rudra-Model/actions/workflows/php.yml)
[![Maintainability](https://qlty.sh/badges/ca8bb591-ff66-41c3-8f18-4d4a93b3ee41/maintainability.svg)](https://qlty.sh/gh/Jagepard/projects/Rudra-Model)
[![CodeFactor](https://www.codefactor.io/repository/github/jagepard/rudra-model/badge)](https://www.codefactor.io/repository/github/jagepard/rudra-model)
[![Coverage Status](https://coveralls.io/repos/github/Jagepard/Rudra-Model/badge.svg?branch=master)](https://coveralls.io/github/Jagepard/Rudra-Model?branch=master)
Expand Down
8 changes: 4 additions & 4 deletions src/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ protected static function updateStmtString(array $fields): string
{
$stmtFields = [];

foreach ($fields as $key => $data) {
foreach (array_keys($fields) as $key) {
$stmtFields[] = "{$key}=:{$key}";
}

Expand All @@ -238,14 +238,14 @@ protected static function updateStmtString(array $fields): string
* - A list of column names.
* - A list of placeholders (prefixed with colons) for parameter binding.
* These strings can be directly used in the SQL INSERT query.
*/
*/
protected static function createStmtString(array $fields): array
{
$insert = [];
$execute = [];

foreach ($fields as $key => $data) {
$insert[] = "{$key}";
foreach (array_keys($fields) as $key) {
$insert[] = $key;
$execute[] = ":{$key}";
}

Expand Down
Loading