diff --git a/tests/unit/Firewall/Adapter/Micro/Acl/GetDefaultAccessCest.php b/tests/unit/Firewall/Adapter/Micro/Acl/GetSetDefaultAccessCest.php similarity index 58% rename from tests/unit/Firewall/Adapter/Micro/Acl/GetDefaultAccessCest.php rename to tests/unit/Firewall/Adapter/Micro/Acl/GetSetDefaultAccessCest.php index c67fc222b61..a7256c5c351 100644 --- a/tests/unit/Firewall/Adapter/Micro/Acl/GetDefaultAccessCest.php +++ b/tests/unit/Firewall/Adapter/Micro/Acl/GetSetDefaultAccessCest.php @@ -12,20 +12,26 @@ namespace Phalcon\Test\Unit\Firewall\Adapter\Micro\Acl; +use Phalcon\Acl as PhAcl; +use Phalcon\Firewall\Adapter\Micro\Acl; use UnitTester; -class GetDefaultAccessCest +class GetSetDefaultAccessCest { /** - * Tests Phalcon\Firewall\Adapter\Micro\Acl :: getDefaultAccess() + * Tests Phalcon\Firewall\Adapter\Micro\Acl :: getDefaultAccess()/setDefaultAccess() * * @author Phalcon Team * @since 2019-05-12 */ - public function firewallAdapterMicroAclGetDefaultAccess(UnitTester $I) + public function firewallAdapterMicroAclGetSetDefaultAccess(UnitTester $I) { - $I->wantToTest('Firewall\Adapter\Micro\Acl - getDefaultAccess()'); + $I->wantToTest('Firewall\Adapter\Micro\Acl - getDefaultAccess()/setDefaultAccess()'); - $I->skipTest('Need implementation'); + $firewall = new Acl('acl'); + $firewall->setDefaultAccess(PhAcl::ALLOW); + + $actual = $firewall->getDefaultAccess(); + $I->assertEquals(PhAcl::ALLOW, $actual); } } diff --git a/tests/unit/Firewall/Adapter/Micro/Acl/GetEventsManagerCest.php b/tests/unit/Firewall/Adapter/Micro/Acl/GetSetEventsManagerCest.php similarity index 55% rename from tests/unit/Firewall/Adapter/Micro/Acl/GetEventsManagerCest.php rename to tests/unit/Firewall/Adapter/Micro/Acl/GetSetEventsManagerCest.php index 3d22d891176..eebcbefda88 100644 --- a/tests/unit/Firewall/Adapter/Micro/Acl/GetEventsManagerCest.php +++ b/tests/unit/Firewall/Adapter/Micro/Acl/GetSetEventsManagerCest.php @@ -12,20 +12,28 @@ namespace Phalcon\Test\Unit\Firewall\Adapter\Micro\Acl; +use Phalcon\Events\Manager; +use Phalcon\Firewall\Adapter\Micro\Acl; use UnitTester; -class GetEventsManagerCest +class GetSetEventsManagerCest { /** - * Tests Phalcon\Firewall\Adapter\Micro\Acl :: getEventsManager() + * Tests Phalcon\Firewall\Adapter\Micro\Acl :: getEventsManager()/setEventsManager() * * @author Phalcon Team * @since 2019-05-12 */ - public function firewallAdapterMicroAclGetEventsManager(UnitTester $I) + public function firewallAdapterMicroAclGetSetEventsManager(UnitTester $I) { - $I->wantToTest('Firewall\Adapter\Micro\Acl - getEventsManager()'); + $I->wantToTest('Firewall\Adapter\Micro\Acl - getEventsManager()/setEventsManager()'); - $I->skipTest('Need implementation'); + $firewall = new Acl('acl'); + $eventsManager = new Manager(); + + $firewall->setEventsManager($eventsManager); + + $actual = $firewall->getEventsManager(); + $I->assertEquals($eventsManager, $actual); } } diff --git a/tests/unit/Firewall/Adapter/Micro/Acl/SetCacheCest.php b/tests/unit/Firewall/Adapter/Micro/Acl/SetCacheCest.php index 9dd7c0bfc75..fad3ef9aef0 100644 --- a/tests/unit/Firewall/Adapter/Micro/Acl/SetCacheCest.php +++ b/tests/unit/Firewall/Adapter/Micro/Acl/SetCacheCest.php @@ -27,6 +27,7 @@ use Phalcon\Test\Fixtures\Traits\DiTrait; use Phalcon\Test\Fixtures\Traits\FirewallTrait; use Phalcon\Test\Models\AlbumORama\Albums; +use function sleep; use UnitTester; class SetCacheCest @@ -173,6 +174,11 @@ function (BindingRole $user) { ); $I->assertEquals($returnedValue, $example[2]); $I->assertEquals($cache->get('_PHF_')[$example[3]], $example[4]); + + /** + * Hack to remove the too many connections + */ + sleep(1); } /** diff --git a/tests/unit/Firewall/Adapter/Micro/Acl/SetDefaultAccessCest.php b/tests/unit/Firewall/Adapter/Micro/Acl/SetDefaultAccessCest.php deleted file mode 100644 index 7e7a082914b..00000000000 --- a/tests/unit/Firewall/Adapter/Micro/Acl/SetDefaultAccessCest.php +++ /dev/null @@ -1,31 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE.txt - * file that was distributed with this source code. - */ - -namespace Phalcon\Test\Unit\Firewall\Adapter\Micro\Acl; - -use UnitTester; - -class SetDefaultAccessCest -{ - /** - * Tests Phalcon\Firewall\Adapter\Micro\Acl :: setDefaultAccess() - * - * @author Phalcon Team - * @since 2019-05-12 - */ - public function firewallAdapterMicroAclSetDefaultAccess(UnitTester $I) - { - $I->wantToTest('Firewall\Adapter\Micro\Acl - setDefaultAccess()'); - - $I->skipTest('Need implementation'); - } -} diff --git a/tests/unit/Firewall/Adapter/Micro/Acl/SetEventsManagerCest.php b/tests/unit/Firewall/Adapter/Micro/Acl/SetEventsManagerCest.php deleted file mode 100644 index 2ae631cdc1c..00000000000 --- a/tests/unit/Firewall/Adapter/Micro/Acl/SetEventsManagerCest.php +++ /dev/null @@ -1,31 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE.txt - * file that was distributed with this source code. - */ - -namespace Phalcon\Test\Unit\Firewall\Adapter\Micro\Acl; - -use UnitTester; - -class SetEventsManagerCest -{ - /** - * Tests Phalcon\Firewall\Adapter\Micro\Acl :: setEventsManager() - * - * @author Phalcon Team - * @since 2019-05-12 - */ - public function firewallAdapterMicroAclSetEventsManager(UnitTester $I) - { - $I->wantToTest('Firewall\Adapter\Micro\Acl - setEventsManager()'); - - $I->skipTest('Need implementation'); - } -}