public function testGetByType() { $this->assertEquals(0, count(StuckJob::getAll())); $stuckJob = new StuckJob(); $stuckJob->type = 'abc'; $stuckJob->quantity = 3; $this->assertTrue($stuckJob->save()); $stuckJob = new StuckJob(); $stuckJob->type = 'abc'; $stuckJob->quantity = 3; $this->assertTrue($stuckJob->save()); $stuckJob = new StuckJob(); $stuckJob->type = 'def'; $stuckJob->quantity = 3; $this->assertTrue($stuckJob->save()); $stuckJob = StuckJob::getByType('abc'); $this->assertEquals(1, count($stuckJob)); $this->assertEquals('abc', $stuckJob->type); $this->assertTrue($stuckJob->id > 0); $stuckJob = StuckJob::getByType('def'); $this->assertEquals(1, count($stuckJob)); $this->assertEquals('def', $stuckJob->type); $this->assertTrue($stuckJob->id > 0); $stuckJob = StuckJob::getByType('hij'); $this->assertEquals(1, count($stuckJob)); $this->assertTrue($stuckJob->id < 0); }