Examples
Tip: For more in-depth examples. Check out how we test concrete5 in our tests on github to learn more.
Package Testing
Here you will find a few examples for testing packages
Installing a package from the dashboard
// PackageCest.php
<?php
namespace C5Browser\Test\Page;
use AcceptanceTester;
class PackageCest
{
public function installPackage(AcceptanceTester $I)
{
// Login With username
$I->login('username', 'password');
// Install the package with the following name
$I->installPackage('Package Name');
// Check the Package Name Details page
$I->checkPackageDetails('Package Name',
// Check Details - SinglePages/Jobs/BlockTypes
// Followed by the number of Types/Pages/Etc
['BlockTypes' => 1,
'SinglePages' => 1
]);
}
}
Removing a package from the dashboard
// PackageCest.php
<?php
namespace C5Browser\Test\Page;
use AcceptanceTester;
class PackageCest
{
public function removePackage(AcceptanceTester $I)
{
// Login With username
$I->login('username', 'password');
// Package Name and Timeout in seconds
$I->uninstallPackage('Package Name', 30);
}
}
Installing and remove package from the dashboard
// PackageCest.php
<?php
namespace C5Browser\Test\Page;
use AcceptanceTester;
class PackageCest
{
// Will run before each test
public function _before(AcceptanceTester $I) {
// Login With username
$I->login('username', 'password');
}
public function installPackage(AcceptanceTester $I)
{
// Install the package with the following name
$I->installPackage('Package Name');
// Check the Package Name Details page
$I->checkPackageDetails('Package Name',
// Check Details - SinglePages/Jobs/BlockTypes
// Followed by the number of Types/Pages/Etc
['BlockTypes' => 1,
'SinglePages' => 1
]);
}
public function removePackage(AcceptanceTester $I)
{
// Package Name and Timeout in seconds
$I->uninstallPackage('Package Name', 30);
}
}