public function testInstallCategories() { $category = new PermissionCategory('foo category', 'foo_category'); $pcp = $this->permissionCategoriesProvider; $pcp->expects($this->atLeastOnce())->method('getItems')->will($this->returnValue(array($category))); $result = $this->installer->installCategories(); $this->assertValidResultStructure($result); $this->assertEquals(1, $result['installed']); $this->assertEquals(0, $result['removed']); /* @var PermissionCategoryEntity $installedCategory */ $installedCategory = $this->getLastRecordInDatabase(PermissionCategoryEntity::clazz()); $this->assertNotNull($installedCategory); $this->assertEquals($category->getName(), $installedCategory->getName()); $this->assertEquals($category->getTechnicalName(), $installedCategory->getTechnicalName()); // --- $result = $this->installer->installCategories(); $this->assertValidResultStructure($result); $this->assertEquals(0, $result['installed']); $this->assertEquals(0, $result['removed']); }
public function testConstructorAndGetters() { $pc = new PermissionCategory('foo name', 'foo_name'); $this->assertEquals('foo name', $pc->getName()); $this->assertEquals('foo_name', $pc->getTechnicalName()); }