persistenceManager instanceof PersistenceManager) { $this->markTestSkipped('Doctrine persistence is not enabled'); } $this->resourceManager = $this->objectManager->get(ResourceManager::class); } /** * @test */ public function itFindsAssetsHavingAnOwnAttribute(): void { $resource = $this->resourceManager->importResourceFromContent('hello world', 'hello-world.txt'); $asset = new Asset($resource); $asset->getAttributes()->set('author', new AssetAttribute('author', 'Joe')); $this->persistenceManager->add($asset); $resource2 = $this->resourceManager->importResourceFromContent('hello universe', 'hello-universe.txt'); $asset2 = new Asset($resource2); $this->persistenceManager->add($asset2); $this->persistenceManager->persistAll(); $query = new Query(Asset::class); $result = $query->matching($query->logicalAnd([ $query->equals('attributes.name', 'author'), $query->equals('attributes.value', 'Joe'), ]))->execute(); static::assertCount(1, $result); } }