for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Redaxscript\Tests\Module;
use Redaxscript\Db;
use Redaxscript\Model;
use Redaxscript\Tests\TestCaseAbstract;
/**
* GroupTest
*
* @since 3.3.0
* @package Redaxscript
* @group Tests
* @author Henry Ruhs
*/
class GroupTest extends TestCaseAbstract
{
* setUp
public function setUp()
parent::setUp();
$installer = $this->installerFactory();
$installer->init();
$installer->rawCreate();
$installer->insertSettings(
[
'adminName' => 'Test',
'adminUser' => 'test',
'adminPassword' => 'test',
'adminEmail' => '[email protected]'
]);
Db::forTablePrefix('groups')
->create()
->set(
'name' => 'Group One',
'alias' => 'group-one'
])
->save();
'name' => 'Group Two',
'alias' => 'group-two'
'name' => 'Group Three',
'alias' => 'group-three'
}
* tearDown
public function tearDown()
$installer->rawDrop();
* providerGroupGetId
* @return array
public function providerGroupGetId() : array
return $this->getProvider('tests/provider/Model/group_get_id.json');
* testGetIdByAlias
* @param string $alias
* @param int $expect
* @dataProvider providerGroupGetId
public function testGetIdByAlias(string $alias = null, int $expect = null)
/* setup */
$groupModel = new Model\Group();
/* actual */
$actual = $groupModel->getIdByAlias($alias);
/* compare */
$this->assertEquals($expect, $actual);