Skip to content

Commit

Permalink
Add unit test for hasActiveSubclass when only one subclass
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathonwalz committed Feb 24, 2014
1 parent bf36ce8 commit 16921b1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Tests/Admin/AdminTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,18 @@ public function testNonExistantSubclass()
$admin->getActiveSubClass();
}

/**
* @covers Sonata\AdminBundle\Admin\Admin::hasActiveSubClass
*/
public function testOnlyOneSubclassNeededToBeActive()
{
$admin = new PostAdmin('sonata.post.admin.post', 'NewsBundle\Entity\Post', 'SonataNewsBundle:PostAdmin');
$admin->setSubClasses(array('extended1' => 'NewsBundle\Entity\PostExtended1'));
$request = new \Symfony\Component\HttpFoundation\Request(array('subclass' => 'extended1'));
$admin->setRequest($request);
$this->assertTrue($admin->hasActiveSubClass());
}

public function testGetPerPageOptions()
{
$admin = new PostAdmin('sonata.post.admin.post', 'NewsBundle\Entity\Post', 'SonataNewsBundle:PostAdmin');
Expand Down

0 comments on commit 16921b1

Please sign in to comment.