示例#1
0
 public function testDeterminedPerPageValue()
 {
     $admin = new PostAdmin('sonata.post.admin.post', 'Acme\\NewsBundle\\Entity\\Post', 'SonataNewsBundle:PostAdmin');
     $this->assertFalse($admin->determinedPerPageValue('foo'));
     $this->assertFalse($admin->determinedPerPageValue(123));
     $this->assertTrue($admin->determinedPerPageValue(16));
     $this->assertTrue($admin->determinedPerPageValue(32));
     $this->assertTrue($admin->determinedPerPageValue(64));
     $this->assertTrue($admin->determinedPerPageValue(128));
     $this->assertTrue($admin->determinedPerPageValue(192));
     $admin->setPerPageOptions(array(101, 102, 103));
     $this->assertFalse($admin->determinedPerPageValue(15));
     $this->assertFalse($admin->determinedPerPageValue(25));
     $this->assertFalse($admin->determinedPerPageValue(200));
     $this->assertTrue($admin->determinedPerPageValue(101));
     $this->assertTrue($admin->determinedPerPageValue(102));
     $this->assertTrue($admin->determinedPerPageValue(103));
 }