Skip to content

Instantly share code, notes, and snippets.

View ppeiris's full-sized avatar
🏋️‍♂️
Working on machine learning projects

Prabath Peiris ppeiris

🏋️‍♂️
Working on machine learning projects
View GitHub Profile
<?php
namespace AccountServiceTest;
use Zend\Loader\AutoloaderFactory;
use Zend\Mvc\Service\ServiceManagerConfig;
use Zend\ServiceManager\ServiceManager;
use RuntimeException;
error_reporting(E_ALL | E_STRICT);
<?php
public function onBootstrap(MvcEvent $event)
{
$eventManager = $event->getApplication()->getEventManager();
$eventManager->attach(MvcEvent::EVENT_ROUTE, array($this, 'apiTestAuth'), -100);
}
public function apiTestAuth(MvcEvent $event)
<?php
public function onBootstrap(MvcEvent $event)
{
$eventManager = $event->getApplication()->getEventManager();
$eventManager->attach(MvcEvent::EVENT_DISPATCH_ERROR, array($this, 'catchApi404Error'), 1000);
}
public function catchApi404Error(MvcEvent $e)
# Codeception Test Suite Configuration
# suite for acceptance tests.
# perform tests in browser using the WebDriver or PhpBrowser.
# (tip: that's what your customer will see).
# (tip: test your ajax and javascript only with WebDriver).
class_name: WebGuy
modules:
enabled:
<?php
/****** IN THE MODULE.CONFIG.PHP (ZF-HAL SECTION) ***********************************/
'AccountsApi\\V1\\Rest\\Utility\\UtilityEntity' => array(
//'identifier_name' => 'id',
'route_name' => 'AccountsApi.rest.accounts.utility',
//'hydrator' => 'ArraySerializable',
'hydrator' => 'AccountsApi\\V1\\Rest\\Hydrators\\UtilityEntityHydrate',
),
{
"address": {
"address1": "2916 SE 125th Ave 36",
"address2": " sdf",
"city": "Portland.",
"state": "OR",
"zip": "97236",
"country": "USA"
}
# Codeception Test Suite Configuration
# suite for acceptance tests.
# perform tests in browser using the Selenium-like tools.
# powered by Mink (http://mink.behat.org).
# (tip: that's what your customer will see).
# (tip: test your ajax and javascript by one of Mink drivers).
# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.
<?php
namespace OappAccessControl;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use Zend\ServiceManager\ServiceLocatorAwareInterface;
use Zend\Permissions\Acl\Acl as AccessControlList;
use Zend\Permissions\Acl\Role\GenericRole as Role;
use Zend\Permissions\Acl\Resource\GenericResource as Resource;
@ppeiris
ppeiris / blog_zf2index.php
Created November 13, 2013 17:48
updated zf2 index.php file to include the development.config.php modules
<?php
/**
* This makes our life easier when dealing with paths. Everything is relative
* to the application root now.
*/
chdir(dirname(__DIR__));
// Decline static file requests back to the PHP built-in webserver
if (php_sapi_name() === 'cli-server' && is_file(__DIR__ . parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH))) {
return false;
@ppeiris
ppeiris / blog_dev.conf.php
Created November 13, 2013 17:37
dev config file for zf2
<?php
/** Modules are in this file should only be activated in development env */
return array(
'modules' => array('ZfTools',
'ZF\Apigility\Admin'
),
);