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
1 change: 1 addition & 0 deletions .github/workflows/psalm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ jobs:
name: Run Psalm
runs-on: ubuntu-latest


steps:
- name: Checkout code
uses: actions/checkout@v3
Expand Down
21 changes: 17 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,22 @@ concurrency:

jobs:
tests:
services:
neo4j:
image: neo4j:latest
ports:
- 7474:7474
- 7687:7687
env:
NEO4J_AUTH: neo4j/password
options: >-
--health-cmd "wget --no-verbose --tries=1 --spider localhost:7474 || exit 1"
--health-interval 10s
--health-retries 5
--health-timeout 5s

name: Run PHPUnit Tests
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
Expand All @@ -35,7 +48,7 @@ jobs:

- name: Run Tests without phpunit.xml
env:
NEO4J_ADDRESS: ${{ secrets.NEO4J_ADDRESS }}
NEO4J_USERNAME: ${{ secrets.NEO4J_USERNAME }}
NEO4J_PASSWORD: ${{ secrets.NEO4J_PASSWORD }}
NEO4J_ADDRESS: "http://localhost:7474"
NEO4J_USERNAME: "neo4j"
NEO4J_PASSWORD: "password"
run: vendor/bin/phpunit --configuration phpunit.dist.xml
44 changes: 44 additions & 0 deletions .github/workflows/testaura.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Test Neo4j Aura

on:
push:
branches:
- main
workflow_dispatch: # Allows manual trigger

concurrency:
group: neo4j-aura-test-main
cancel-in-progress: true

jobs:
tests-aura:
name: Run PHPUnit Tests with Neo4j Aura
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.2
tools: composer, xdebug

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

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

- name: Run Tests
env:
NEO4J_ADDRESS: ${{ secrets.NEO4J_ADDRESS }}
NEO4J_USERNAME: ${{ secrets.NEO4J_USERNAME }}
NEO4J_PASSWORD: ${{ secrets.NEO4J_PASSWORD }}
run: vendor/bin/phpunit --configuration phpunit.dist.xml
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Use an official PHP image as the base image
FROM php:8.2-fpm

# Install necessary extensions (e.g., for Composer)
RUN apt-get update && apt-get install -y libpng-dev libjpeg-dev libfreetype6-dev \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install gd

# Set working directory
WORKDIR /var/www

# Copy the composer.phar file to the container
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

# Expose PHP-FPM port
EXPOSE 9000

# Start PHP-FPM server
CMD ["php-fpm"]
44 changes: 44 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
version: '3.8'

services:
# PHP Service
app:
build:
context: .
dockerfile: Dockerfile
container_name: php-app
working_dir: /var/www
volumes:
- .:/var/www
networks:
- mynetwork
ports:
- "9000:9000" # Exposing port for PHP-FPM

# Composer Service
composer:
image: composer:latest
container_name: composer
volumes:
- .:/var/www
working_dir: /var/www
networks:
- mynetwork
command: ["install", "--no-progress", "--prefer-dist"]

# Neo4j Service (Optional, if you need Neo4j)
neo4j:
image: neo4j:latest
container_name: neo4j
environment:
- NEO4J_AUTH=neo4j/password
ports:
- "7474:7474" # Web interface
- "7687:7687" # Bolt protocol
networks:
- mynetwork

# Define a network for communication between containers
networks:
mynetwork:
driver: bridge
13 changes: 1 addition & 12 deletions tests/Integration/Neo4jQueryAPIIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -393,18 +393,7 @@ public function testInvalidQueryException(): void
}
}

public function testCreateDuplicateConstraintException(): void
{
try {
$this->api->run('CREATE CONSTRAINT person_name FOR (n:Person1) REQUIRE n.name IS UNIQUE', []);
$this->fail('Expected a Neo4jException to be thrown.');
} catch (Neo4jException $e) {
// $errorMessages = $e->getErrorType() . $e->errorSubType() . $e->errorName();
$this->assertInstanceOf(Neo4jException::class, $e);
$this->assertEquals('Neo.ClientError.Schema.EquivalentSchemaRuleAlreadyExists', $e->getErrorCode());
$this->assertNotEmpty($e->getMessage());
}
}


public function testWithExactNames(): void
{
Expand Down