Skip to content

Instantly share code, notes, and snippets.

View robertbasic's full-sized avatar

Robert Basic robertbasic

View GitHub Profile
Not sure about phpunit's mock building, but with mockery you could possibly mock
the Article class - not the entire class, but just the createQueryBuilder method,
which you set that to return a mock of the query builder, on which you further
set the expectations. Something like:
<?php
use \Mockery as m;
function testQueryBuilder()
{
$qbMock = m::mock(...QueryBuilderClassGoesHere...);
<?php
class Foo
{
public static function dataProvider()
{
return array(array('foo'));
}
}
<?php
public function testFetchAllReturnsAllAlbums()
{
$resultSet = new ResultSet();
$mockSelect = $this->getMock('Zend\Db\Sql\Select', array('columns'), array(), '', false);
$mockSelect->expects($this->once())
->method('columns')
->with(array('artist', 'title', 'id'))
Found a nice list on Facebook, via [LongboardEurope](https://www.facebook.com/LongboardEurope/posts/463935783669834)
This Midnight Sun longboard festival sounds nice https://www.facebook.com/groups/372945166119178/?fref=ts
Freerides for 2013
Events marked * are unconfirmed.
**April**
<?php
class MyClass
{
public function foo($paramA, $paramB)
{
return $paramA . $paramB;
}
public function bar($paramA, $paramB)
{
<?php
namespace HexCommon\View\Helper;
use Zend\View\Helper\AbstractHelper;
use Zend\ServiceManager\ServiceLocatorAwareInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
/**
* An abstract view helper, to be implemented by view helpers
robert@odin ~/www/robertbasic.com[zf2*]$ ab -n10 -c10 http://robertbasic.local/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking robertbasic.local (be patient).....done
Server Software: Apache/2.2.22
Server Hostname: robertbasic.local
public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
{
$namespace = substr($requestedName, 0, strpos($requestedName, 'ModelTable'));
$classname = substr($requestedName, strlen($namespace . 'ModelTable'));
$class = ucfirst($namespace) . "\\Model\\Table\\" . ucfirst($classname);
$dbAdapter = $serviceLocator->get('dbAdapter');
$table = new $class($dbAdapter);
<?php
//module.config.php
return array(
'factories' => array(
'model.Foo' => 'Foo\Factory\ModelFactory'
)
);
// Foo/Factory/ModelFactory.php
<?php
$slugConstraints = '[\w_-]+';
$pagenumberChild = array(
'type' => 'segment',
'options' => array(
'route' => '/page/:page',
'constraints' => array(
'page' => '\d+'