This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class MyDateTime extends DateTime | |
{ | |
protected $_daysOfTheWeek = array('sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'); | |
public function lastDayOfTheMonth() | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ACDC { | |
protected $_data = null; | |
public function data() | |
{ | |
$args = func_get_args(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{# I was reading the twig docs this evening and decided to give good ole fizzbuzz a try #} | |
{% for i in range(1,100) %} | |
<div> | |
{% if i is divisibleby(15) %} | |
Fizzbuzz | |
{% elseif i is divisibleby(3) %} | |
Fizz | |
{% elseif i is divisibleby(5) %} | |
Buzz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// interesting bits up here | |
public function persist() | |
{ | |
try { | |
// maybe do some preprocessing of the file | |
// make sure it's safe, etc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// interesting bits | |
protected function _persist() | |
{ | |
$this->_location = tempnam(sys_get_temp_dir(), 'UL-'); | |
if (!$this->_moveUploadedFile()) { | |
unlink($this->_location); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// interesting bits | |
public function test_protected_persist_directly_with_reflection_success() | |
{ | |
$filePersister = new File($_FILES, $this->logger); | |
$reflectedPersist = new \ReflectionMethod($filePersister, '_persist'); | |
$reflectedPersist->setAccessible(true); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class TestableFile extends File | |
{ | |
public function _persistWrapper() | |
{ | |
$this->_persist(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//interesting bits | |
public function test_protected_persist_with_testable_subclass_success() | |
{ | |
$filePersister = new TestableFile($_FILES, $this->logger); | |
$filePersister->_persistWrapper(); | |
$persistedLocation = \PHPUnit_Framework_Assert::readAttribute($filePersister, '_location'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// interesting bits | |
public function test_protected_persist_indirectly_via_public_persist_success() | |
{ | |
$filePersister = new File($_FILES, $this->logger); | |
$this->assertTrue($filePersister->persist()); | |
$persistedLocation = \PHPUnit_Framework_Assert::readAttribute($filePersister, '_location'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once __DIR__ . '/../scripts/bootstrap.php'; | |
$app->get('/upload', 'Pxweb\Controller\UploadController::indexAction'); | |
$app->post('/upload', 'Pxweb\Controller\UploadController::uploadAction'); | |
$app->post('/sendToGoogle', 'Pxweb\Controller\GearmanController::uploadAction'); | |
$app->get('/show/{id}', 'Pxweb\Controller\PictureController::showAction'); |
OlderNewer