Skip to content

Instantly share code, notes, and snippets.

View makallio85's full-sized avatar

Marko Kallio makallio85

View GitHub Profile
<?php
namespace SptSoftware\Statement\Model\Table;
use Cake\Database\Schema\TableSchema;
use Cake\ORM\RulesChecker;
use Cake\ORM\Table;
use Cake\Validation\Validator;
/**
<?php
use Migrations\AbstractMigration;
class Initial extends AbstractMigration
{
public function up()
{
$table = $this->table('core_requests');
.Exception: Referenced fixture class "InformationServices\Test\Fixture\BisnodeQueriesFixture" not found.
Fixture "plugin.information_services.bisnode_queries" was referenced in test
case "InformationServices\Test\TestCase\Model\Table\BisnodeQueriesTableTest".
in [D:\xampp\htdocs\api_app\vendor\cakephp\cakephp\src\TestSuite\Fixture\FixtureManager.php, line 213]
$this->get('/');
$this->assertResponseCode(404);
$res = json_decode($this->_response->body());
$this->assertEquals($res->headers->response->code, 404);
$this->assertEquals($res->headers->response->errorMessage, 'Bad request!');
$this->controller->set('response', Response::instance()->toArray());
$this->controller->set('_serialize', 'response');
$this->controller->response->statusCode($this->_getCode());
$this->controller->response->type('json');
$this->controller->View = $this->controller->createView();
$this->controller->response->body($this->controller->View->render('Core.Error/json_error', false));
$this->controller->response->send();
$this->set('response', $responseArray);
$this->set('_serialize', 'response');
$this->response->statusCode($code);
$this->response->type('json');
$event = new Event(
'Log.Request.save', [
'Request' => $this->_Request,
'data' => [
'get' => $this->request->query,
'post' => $this->request->data,
'client_ip_address' => $this->request->clientIp(),
'uri' => $this->request->url,
],
]
class AppExceptionRenderer extends ExceptionRenderer
{
public function render()
{
$exception = $this->error;
$this->controller->set('response', ['foo' => 'bar']);
$this->controller->set('_serialize', 'response');
$this->controller->response->statusCode($exception->getCode());
$this->controller->response->type('json');
@makallio85
makallio85 / test
Last active December 30, 2015 17:25
people:
path: /people
config: PluginPeople.people_routes
cars:
path: /
config:
plugin: PluginCars
controller: Cars
action: index
$query->select(function ($exp) use ($query) {
$concatPerson = $query->func()->concat(['lastname' => 'literal', ', ', 'firstnames' => 'literal']);
return $exp->addCase(
[
$query->newExpr()->eq('type', 1),
$query->newExpr()->eq('type', 2),
],
[$concatPerson, 'business_name'],
['string', 'string']
);