function testInsert() { $new = new SListDecorator(new Topic(array('forum_id' => 2)), 'forum'); $new->save(); $this->assertEqual(1, $new->position); $this->assertTrue($new->isFirst()); $this->assertTrue($new->isLast()); $new = new SListDecorator(new Topic(array('forum_id' => 2)), 'forum'); $new->save(); $this->assertEqual(2, $new->position); $this->assertFalse($new->isFirst()); $this->assertTrue($new->isLast()); $new = new SListDecorator(new Topic(array('forum_id' => 2)), 'forum'); $new->save(); $this->assertEqual(3, $new->position); $this->assertFalse($new->isFirst()); $this->assertTrue($new->isLast()); $new = new SListDecorator(new Topic(array('forum_id' => 3)), 'forum'); $new->save(); $this->assertEqual(1, $new->position); $this->assertTrue($new->isFirst()); $this->assertTrue($new->isLast()); }