public function testGetMaxRank() { $this->assertEquals(4, Table12Query::create()->getMaxRank(1), 'getMaxRank() returns the maximum rank in the scope'); $this->assertEquals(2, Table12Query::create()->getMaxRank(2), 'getMaxRank() returns the maximum rank in the scope'); // delete one $t4 = Table12Query::create()->findOneByRank(4, 1); $t4->delete(); $this->assertEquals(3, Table12Query::create()->getMaxRank(1), 'getMaxRank() returns the maximum rank'); // add one $t = new Table12(); $t->setMyScopeColumn(1); $t->save(); $this->assertEquals(4, Table12Query::create()->getMaxRank(1), 'getMaxRank() returns the maximum rank'); // delete all Table12Query::create()->deleteAll(); $this->assertNull(Table12Query::create()->getMaxRank(1), 'getMaxRank() returns null for empty tables'); // add one $t = new Table12(); $t->setMyScopeColumn(1); $t->save(); $this->assertEquals(1, Table12Query::create()->getMaxRank(1), 'getMaxRank() returns the maximum rank'); }