/** * Bosnadev's findWhere() method * @test */ function it_can_perform_a_findwhere_with_custom_parameters() { // simple field/value combo's by key $this->assertCount(1, $this->repository->findWhere([self::UNIQUE_FIELD => '1234567', self::SECOND_FIELD => '434']), "findWhere() with field/value combo failed (incorrect match count)"); // arrays with field/value sets $this->assertCount(1, $this->repository->findWhere([[self::UNIQUE_FIELD, '1234567'], [self::SECOND_FIELD, '434']]), "findWhere() with field/value sets failed (incorrect match count)"); // arrays with field/operator/value sets $this->assertCount(1, $this->repository->findWhere([[self::UNIQUE_FIELD, 'LIKE', '%234567'], [self::SECOND_FIELD, 'LIKE', '43%']]), "findWhere() with field/operator/value sets failed (incorrect match count)"); // closure send directly to the model's where() method $this->assertCount(1, $this->repository->findWhere([function ($query) { return $query->where(self::UNIQUE_FIELD, 'LIKE', '%234567'); }]), "findWhere() with Closure callback failed (incorrect match count)"); }