assertEquals("SELECT data FROM here WHERE data->>'id' = :id", Find::byId('here'), 'SELECT query not generated correctly'); } public function testByFieldsSucceeds(): void { Configuration::$mode = Mode::SQLite; $this->assertEquals("SELECT data FROM there WHERE data->>'active' = :act OR data->>'locked' = :lock", Find::byFields('there', [Field::EQ('active', true, ':act'), Field::EQ('locked', true, ':lock')], FieldMatch::Any), 'SELECT query not generated correctly'); } #[TestDox('By contains succeeds for PostgreSQL')] public function testByContainsSucceedsForPostgreSQL(): void { Configuration::$mode = Mode::PgSQL; $this->assertEquals('SELECT data FROM disc WHERE data @> :criteria', Find::byContains('disc'), 'SELECT query not generated correctly'); } #[TestDox('By contains fails for non PostgreSQL')] public function testByContainsFailsForNonPostgreSQL(): void { $this->expectException(DocumentException::class); Find::byContains(''); } #[TestDox('By JSON Path succeeds for PostgreSQL')] public function testByJsonPathSucceedsForPostgreSQL(): void { Configuration::$mode = Mode::PgSQL; $this->assertEquals('SELECT data FROM light WHERE data @? :path::jsonpath', Find::byJsonPath('light'), 'SELECT query not generated correctly'); } #[TestDox('By JSON Path fails for non PostgreSQL')] public function testByJsonPathFailsForNonPostgreSQL(): void { $this->expectException(DocumentException::class); Find::byJsonPath(''); } }