diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8c72c5e..dc041fc 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -3,7 +3,7 @@ name: tests on: [push] jobs: - tests: + no_ext_tests: runs-on: ubuntu-22.04 strategy: @@ -27,5 +27,5 @@ jobs: configuration: tests/phpunit.xml version: 10.5 php_version: ${{ matrix.php }} - php_extensions: ffi + args: --filter ReleaseTest diff --git a/src/BufferFactory.php b/src/BufferFactory.php index 762471f..891167b 100644 --- a/src/BufferFactory.php +++ b/src/BufferFactory.php @@ -7,7 +7,7 @@ class BufferFactory { public function isAvailable() : bool { - return extension_loaded('ffi'); + return class_exists(FFI::class); } public function Buffer(int $size, int $dtype) : Buffer diff --git a/tests/RindowTest/Math/Matrix/Buffer/FFI/ReleaseTest.php b/tests/RindowTest/Math/Matrix/Buffer/FFI/ReleaseTest.php new file mode 100644 index 0000000..1e6cebe --- /dev/null +++ b/tests/RindowTest/Math/Matrix/Buffer/FFI/ReleaseTest.php @@ -0,0 +1,22 @@ +Buffer(1,NDArray::float32); + $this->assertInstanceof(Buffer::class,$buffer); + } else { + $this->assertFalse($factory->isAvailable()); + } + } +} \ No newline at end of file