                <button type="button" class="close" data-dismiss="modal">×Close</button>

:)

Thank you from Walis Philippines

                            {{ HTML::image('/assets/images/walisph/paramihan.png', 'paramihan', ['class' => 'img-100 img-responsive']) }}

                            {{ HTML::image('/assets/images/walisph/ubl.png', 'ubl', ['class' => 'img-100 img-responsive']) }}

                            {{ HTML::image('/assets/images/walisph/walis.png', 'walis', ['class' => 'img-100 img-responsive']) }}

                        If you want us to conceptualize, design and develop your very own website, contact the Walis Philippines at info@walis.com.ph.

                        We would like to hear from you soon.

Add the walls philippines copyright view


<?php
/**
 * Check performance of comparing iso8601 dates algorithms
 * @file    CompareISO8601Dates.php
 *
 * PHP version 5.3.9+
 *
 * @author  Alexander Yancharuk <alex@itvault.info>
 * @date    Sun Dec 29 12:18:22 2013
 * @copyright The BSD 3-Clause License.
 */

namespace Tests;

use Veles\Tools\CliProgressBar;
use Veles\Tools\Timer;
use Application\TestApplication;

/**
 * Class CompareISO8601Dates
 *
 * @author Alexander Yancharuk <alex@itvault.info>
 */
class CompareISO8601Dates extends TestApplication
{
    protected static $repeats = 10000;

	final public static function run()
	{
		$repeats = self::getRepeats();
		$date1 = '2011-09-09';
		$date2 = '2011-09-08';

		$bar = new CliProgressBar($repeats);
		for ($i = 1; $i <= $repeats; ++$i) {
			Timer::start();
			if (strtotime($date1) > strtotime($date2)) {}
			Timer::stop();
			$bar->update($i);
		}

		self::addResult('strtotime', Timer::get());

		Timer::reset();
		$bar = new CliProgressBar($repeats);
		for ($i = 1; $i <= $repeats; ++$i) {
			Timer::start();
			if (strcmp($date1, $date2) > 0) {}
			Timer::stop();
			$bar->update($i);
		}

		self::addResult('strcmp', Timer::get());

		Timer::reset();
		$bar = new CliProgressBar($repeats);
		for ($i = 1; $i <= $repeats; ++$i) {
			Timer::start();
			if (new \DateTime($date1) > new \DateTime($date2)) {}
			Timer::stop();
			$bar->update($i);
		}

		self::addResult('DateTime', Timer::get());

		Timer::reset();
		$bar = new CliProgressBar($repeats);
		for ($i = 1; $i <= $repeats; ++$i) {
			Timer::start();
			if ($date1 > $date2) {}
			Timer::stop();
			$bar->update($i);
		}

		self::addResult('string', Timer::get());
	}
}

Test for performance of algorithms comparing ISO 8601 dates


<?php

/**
 * Class for saving normal exceptions for serialization.
 *
 * This class is used by the SimpleSAML_Auth_State class when it needs
 * to serialize an exception which doesn't subclass the
 * SimpleSAML_Error_Exception class.
 *
 * It creates a new exception which contains the backtrace and message
 * of the original exception.
 *
 * @package simpleSAMLphp
 * @version $Id$
 */
class SimpleSAML_Error_UnserializableException extends SimpleSAML_Error_Exception {

	public function __construct(Exception $original) {

		$msg = get_class($original) . ': ' . $original->getMessage();
		$code = $original->getCode();
		parent::__construct($msg, $code);

		$this->setBacktrace(SimpleSAML_Utilities::buildBacktrace($original));
	}

}

Add exception for serializing unserializable exceptions.

The SimpleSAML_Error_Exception class is a base class for serializable
exceptions. This patch adds SimpleSAML_Error_UnserializableException.
That class saves some of the information from an Exception and saves it
in an serializable exception.


<?php

namespace Mimic\Test;

use PHPUnit_Framework_TestCase;
use Mimic\Functional as F;

/**
 * Unit Test for forgetLast Mimic library function.
 *
 * @since 0.1.0
 */
class ForgetLastFuncTest extends PHPUnit_Framework_TestCase {
	public function dataProvider() {
		return array(
			array(array(1, 2, 3), array(1, 2, 3), array(1, 2)),
			array(new ArrayIterator(array(1, 2, 3)), array(1, 2, 3), array(1, 2)),
			array(array('something', 'else'), array('something', 'else'), array('something')),
			array(array('else'), array('else'), array()),
			array(array(), array(), array()),
		);
	}

	/**
	 * @dataProvider dataProvider
	 * @covers ::Mimic\Functional\forgetLast
	 */
	public function testResults($collection, $check, $expected) {
		$this->assertEquals($expected, F\forgetLast($collection));
		$this->assertSame($check, $collection, 'collection has changed');
	}
}

Add forget last function test suite.

Add forget last function test suite.


<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateAttachmentsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('attachments', function (Blueprint $table) {
            $table->string('id');
            $table->text('attachments')->nullable();
            $table->timestamps();
            $table->foreign('id')->references('id')->on('server_messages');
        });
        $to_insert = [];
        foreach (DB::table('server_messages')->select([
            'id',
            'attachments'
        ])->whereNotNull('attachments')->get() as $items) {
            $to_insert[] = [
                'id' => $items->id,
                'attachments' => $items->attachments,
                'created_at' => \Carbon\Carbon::now(),
                'updated_at' => \Carbon\Carbon::now()
            ];
        }
        DB::table('attachments')->insert($to_insert);
        Schema::table('server_messages', function (Blueprint $table) {
            $table->dropColumn('attachments');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('attachments');
        Schema::table('server_messages', function (Blueprint $table) {
            $table->string('attachments')->after('message')->default(null)->nullable();
        });
        foreach (DB::table('attachments')->get() as $data) {
            DB::table('server_messages')->where('id', '=', $data->id)->update(['attachments' => $data->attachments]);
        }
    }
}

Store attachments in a separate table

Store attachments in a separate table


<?php

use Phinx\Migration\AbstractMigration;

class AddShipmentShipDistrictMethod extends AbstractMigration
{
    public function change()
    {
      $table= $this->table('shipment', [ 'signed' => false ]);
      $table
        ->changeColumn('method', 'enum', [
          'values' => [
            'easypost', 'shipdistrict'
          ],
        ])
        ->update();
    }
}

Add Ship District method, remove unused Shippo


<?php
/**
 * CSP
 *
 * @author     Kenji Suzuki <https://github.com/kenjis>
 * @license    MIT License
 * @copyright  2014 Kenji Suzuki
 * @link       https://github.com/kenjis/php-csp-nonce-source
 */

if ($argc !== 2) {
    echo 'Get CSP header of a web page' . PHP_EOL . PHP_EOL;
    echo 'Usage:' . PHP_EOL;
    echo ' php ' . $argv[0] . ' <url>' . PHP_EOL;
    exit;
}

$url = $argv[1];
$components = parse_url($url);
$scheme = $components['scheme'];

$userAgent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.104 Safari/537.36';
$context = stream_context_create([
    $scheme => [
        'method' => 'GET',
        'header' => 'User-Agent: ' . $userAgent . "\r\n",
    ]
]);
$ret = file_get_contents($url, false, $context);

if ($ret === false) {
    echo 'Can\'t get ' . $url . PHP_EOL;
    exit(1);
}

$cspHeader = 'content-security-policy';
$length = strlen($cspHeader);
foreach ($http_response_header as $header) {
    if (strtolower(substr($header, 0, $length)) === $cspHeader) {
        echo 'Raw Header:' .PHP_EOL;
        echo ' ' . $header . PHP_EOL . PHP_EOL;

        $fieldName = substr($header, 0, $length);
        echo $fieldName . ':' . PHP_EOL;

        $fieldValue = substr($header, $length + 1);
        $directives = explode(';', $fieldValue);
        foreach ($directives as $directive) {
            echo $directive . ';' . PHP_EOL;
        }
    }
}

Add script to get CSP header of a site

Add script to get CSP header of a site

[ci skip]


<?php
/**
 * Smarty plugin
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 *
 * @copyright  2013 Kaoru Ishikura
 * @author     Kaoru Ishikura
 * @package    Smarty
 * @subpackage PluginsModifier
 */

/**
 * Smarty unescape entity tag modifier plugin
 *
 * Type:     modifier

 * Name:     unescape_tag

 * Purpose:  unescape entity tag

 * Examples: {$string|unescape:'a,b,strong'}
 *
 * @param string  $string input string
 * @param mixed   $tags   unescape tags, comma separated list of tag names or array of tag names
 * @return string unescaped input html string
 */
function smarty_modifier_unescape_tag($string, $tags = null)
{
    if ($tags === null) {
        $pattern = "/<[^&]*(?:".*?"[^&]*|'.*?'[^&]*)*(?:>|(?=<)|$(?!\x0A))/is"
                 . Smarty::$_UTF8_MODIFIER;
    } else {
        $pattern = '/<\/?(?:' . str_replace("\x20", '', str_replace(',', '|', preg_quote(implode(',', (array)$tags), '/')))
                 . ")(?:|[^0-9a-zA-Z][^&]*|\x20[^&]*(?:".*?"[^&]*|'.*?'[^&]*)*)(?:>|(?=<)|$(?!\x0A))/is"
                 . Smarty::$_UTF8_MODIFIER;
    }

    preg_match_all($pattern, $string, $matches);

    if (isset($matches[0])) {
        $characters = array('<', '>', '"', '\'');
        $entities   = array('<', '>', '"', ''');
        $matches[0] = array_unique($matches[0]);
        foreach ($matches[0] as $match) {
            $replacement = str_replace($entities, $characters, $match);
            $string      = str_replace($match, $replacement, $string);
        }
    }

    return $string;
}

?>

Add unescape entity tag modifier plugin

Add unescape entity tag modifier plugin

Signed-off-by: Kaoru Ishikura <cdb165a9a0fdf6fb03afc7c91b98ee2f15662d4d@sakura-creative.com>


<?php

namespace SitemapGenerator\Tests\Provider;

use SitemapGenerator\Entity\ChangeFrequency;
use SitemapGenerator\Provider\DefaultValues;

class DefaultValuesTest extends \PHPUnit_Framework_TestCase
{
    public function testEmptyDefaultValuesCanBeCreated()
    {
        $values = DefaultValues::none();

        $this->assertFalse($values->hasLastmod());
        $this->assertFalse($values->hasPriority());
        $this->assertFalse($values->hasChangeFreq());

        $this->assertNull($values->getLastmod());
        $this->assertNull($values->getPriority());
        $this->assertNull($values->getChangeFreq());
    }

    public function testDefaultValuesCanBeGiven()
    {
        $priority = 0.4;
        $changeFreq = ChangeFrequency::ALWAYS;
        $lastmod = new \DateTimeImmutable();

        $values = DefaultValues::create($priority, $changeFreq, $lastmod);

        $this->assertTrue($values->hasLastmod());
        $this->assertTrue($values->hasPriority());
        $this->assertTrue($values->hasChangeFreq());

        $this->assertSame($lastmod, $values->getLastmod());
        $this->assertSame($priority, $values->getPriority());
        $this->assertSame($changeFreq, $values->getChangeFreq());
    }
}

Add a few tests for the DefaultValues class


<?php

namespace Mimic\Test;

use PHPUnit_Framework_TestCase;
use Mimic\Functional as F;

/**
 * Unit Test for either Mimic library function.
 *
 * @since 0.1.0
 */
class ExecuteFuncTest extends PHPUnit_Framework_TestCase {
	/**
	 * @covers ::Mimic\Functional\execute
	 */
	public function testIsEmpty() {
		$expected = array();
		$actual = F\execute();
		$this->assertEquals($expected, $actual);
	}

	/**
	 * @covers ::Mimic\Functional\execute
	 */
	public function testIsAllTrue() {
		$callback = function() { return true; };
		$expected = array(true, true, true);
		$actual = F\execute($callback, $callback, $callback);
		$this->assertEquals($expected, $actual);
	}

	/**
	 * @covers ::Mimic\Functional\execute
	 */
	public function testIsAllFalse() {
		$callback = function() { return false; };
		$expected = array(false, false, false);
		$actual = F\execute($callback, $callback, $callback);
		$this->assertEquals($expected, $actual);
	}

	/**
	 * @covers ::Mimic\Functional\execute
	 */
	public function testIsAllSomethingString() {
		$callback = function() { return 'something'; };
		$expected = array('something', 'something', 'something');
		$actual = F\execute($callback, $callback, $callback);
		$this->assertEquals($expected, $actual);
	}

	/**
	 * @covers ::Mimic\Functional\execute
	 */
	public function testNotAllCallBacks() {
		$callback = function() { return true; };
		$expected = array(true, null, true, null);
		$actual = F\execute($callback, null, $callback, '__something__');
		$this->assertEquals($expected, $actual);
	}
}

Add execute function test suite.

Add execute function test suite.


<?php
$this->params([
    'filterFields' => $filterFields = isset($filterFields) ? $filterFields : [
        [
            'class'   => 'flex-2',
            'partial' => 'date-min',
            'params'  => ['property' => 'modify', 'placeholder' => 'Updated'],
        ],
    ],
]);
?>
<?= $this->parent() ?>

Add file list date filter back in

Add file list date filter back in


<?php
/**
 * Check performance drop from include/exclude expression in foreach cycle
 *
 * @file      IncludeFunctionInForeach.php
 *
 * PHP version 5.4+
 *
 * @author    Yancharuk Alexander <alex at itvault dot info>
 * @copyright © 2013-2015 Yancharuk Alexander
 * @date      Fri Dec 04 11:10:26 2015
 * @license   The BSD 3-Clause License.
 *            <https://tldrlegal.com/license/bsd-3-clause-license-(revised)>
 */

namespace Tests;

use Veles\Tools\CliProgressBar;
use Veles\Tools\Timer;
use Application\TestApplication;

/**
 * Class IncludeFunctionInForeach
 *
 * @author Yancharuk Alexander <alex at itvault dot info>
 */
class IncludeFunctionInForeach extends TestApplication
{
    protected $repeats = 10000;

	public function run()
	{
		$repeats = $this->getRepeats();
		$array = range(0,10);

		$bar = new CliProgressBar($repeats);
		for ($i = 1; $i <= $repeats; ++$i) {
			Timer::start();
			$tmp = array_keys($array);
			foreach ($tmp as $value);
			Timer::stop();
			$bar->update($i);
		}

		unset($tmp, $value);
		$this->addResult('Outer function', Timer::get());

		Timer::reset();
		$bar = new CliProgressBar($repeats);
		for ($i = 1; $i <= $repeats; ++$i) {
			Timer::start();
			foreach (array_keys($array) as $value);
			Timer::stop();
			$bar->update($i);
		}

		$this->addResult('Inner function', Timer::get());
	}
}

Add test for include/exclude expression in foreach cycle


<?php

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');

class Migration20130410000000Core extends Hubzero_Migration
{
	protected static function up(&$db)
	{
		$query = "ALTER TABLE `#__forum_sections` ADD INDEX `idx_scoped` (`scope`, `scope_id`);
					ALTER TABLE `#__forum_sections` ADD INDEX `idx_asset_id` (`asset_id`);
					ALTER TABLE `#__forum_sections` ADD INDEX `idx_object_id` (`object_id`);
					ALTER TABLE `#__forum_sections` ADD INDEX `idx_access` (`access`);

					ALTER TABLE `#__forum_categories` ADD INDEX `idx_scoped` (`scope`, `scope_id`);
					ALTER TABLE `#__forum_categories` ADD INDEX `idx_asset_id` (`asset_id`);
					ALTER TABLE `#__forum_categories` ADD INDEX `idx_object_id` (`object_id`);
					ALTER TABLE `#__forum_categories` ADD INDEX `idx_state` (`state`);
					ALTER TABLE `#__forum_categories` ADD INDEX `idx_access` (`access`);
					ALTER TABLE `#__forum_categories` ADD INDEX `idx_section_id` (`section_id`);
					ALTER TABLE `#__forum_categories` ADD INDEX `idx_closed` (`closed`);

					ALTER TABLE `#__forum_posts` ADD INDEX `idx_scoped` (`scope`, `scope_id`);
					ALTER TABLE `#__forum_posts` ADD INDEX `idx_category_id` (`category_id`);
					ALTER TABLE `#__forum_posts` ADD INDEX `idx_access` (`access`);
					ALTER TABLE `#__forum_posts` ADD INDEX `idx_asset_id` (`asset_id`);
					ALTER TABLE `#__forum_posts` ADD INDEX `idx_object_id` (`object_id`);
					ALTER TABLE `#__forum_posts` ADD INDEX `idx_state` (`state`);
					ALTER TABLE `#__forum_posts` ADD INDEX `idx_sticky` (`sticky`);
					ALTER TABLE `#__forum_posts` ADD INDEX `idx_parent` (`parent`);

					ALTER TABLE `#__forum_attachments` ADD INDEX `idx_filename_postid` (`filename`, `post_id`);
					ALTER TABLE `#__forum_attachments` ADD INDEX `idx_parent` (`parent`);

					ALTER TABLE `#__blog_comments` ADD INDEX `idx_entry_id` (`entry_id`);

					ALTER TABLE `#__xmessage_recipient` ADD INDEX `idx_mid` (`mid`);
					ALTER TABLE `#__xmessage_recipient` ADD INDEX `idx_uid` (`uid`);

					ALTER TABLE `#__resource_types` ADD INDEX `idx_category` (`category`);

					DROP TABLE IF EXISTS `#__resource_tags`;
					DROP TABLE IF EXISTS `#__support_tags`;
					DROP TABLE IF EXISTS `#__answers_tags`;";

		$db->setQuery($query);
		$db->query();
	}
}

Add migration script for index additions


<?php

/**
 * Copyright 2016 SURFnet B.V.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

namespace Surfnet\StepupMiddleware\CommandHandlingBundle\Configuration\Command;

use Surfnet\StepupMiddleware\CommandHandlingBundle\Command\AbstractCommand;

class CreateInstitutionConfigurationCommand extends AbstractCommand
{
    /**
     * @Assert\NotBlank()
     * @Assert\Type(type="string")
     *
     * @var string
     */
    public $institution;
}

Introduce command to create an institution configuration


<?php

namespace Oro\Bundle\TestFrameworkBundle\Tests\Unit\DependencyInjection\Compiler;

use Oro\Bundle\TestFrameworkBundle\DependencyInjection\Compiler\ClientCompilerPass;
use Oro\Bundle\TestFrameworkBundle\Test\Client;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;

class ClientCompilerPassTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var ClientCompilerPass
     */
    protected $compilerPass;

    /**
     * @var ContainerBuilder|\PHPUnit_Framework_MockObject_MockObject
     */
    protected $container;

    protected function setUp()
    {
        $this->container = $this->createMock(ContainerBuilder::class);

        $this->compilerPass = new ClientCompilerPass();
    }

    public function testProcessNoProviderDefinition()
    {
        $this->container->expects($this->once())
            ->method('hasDefinition')
            ->with(ClientCompilerPass::CLIENT_SERVICE)
            ->willReturn(false);

        $this->container->expects($this->never())
            ->method('getDefinition')
            ->with(ClientCompilerPass::CLIENT_SERVICE);

        $this->compilerPass->process($this->container);
    }

    public function testProcess()
    {
        $client = new Definition();

        $this->container->expects($this->once())
            ->method('hasDefinition')
            ->with(ClientCompilerPass::CLIENT_SERVICE)
            ->willReturn(true);

        $this->container->expects($this->once())
            ->method('getDefinition')
            ->with(ClientCompilerPass::CLIENT_SERVICE)
            ->willReturn($client);

        $this->compilerPass->process($this->container);

        $this->assertEquals(Client::class, $client->getClass());
    }
}

BAP-16857: Fix running functional tests and investigate test failures
- add tests


<?php

abstract class SQLayerDbo
{

    /** @property *str* database directory **/
    protected $dbDir;

    /** @property *str* database name **/
    protected $dbName;

    /** @property *str* database title **/
    protected $dbTitle;

    /** @property *obj* PDO Connection **/
    protected $pdo;

    /** @method constructor
      * @param  void
      * @return void **/
    public function __construct()
    {

        /** check if directory exists (create if necesssary) **/
        if (!file_exists($this->dbDir)) {
            mkdir($this->dbDir, 0777, true);
        }

        /** check if file will be created (i.e. "true" means file does not exist) **/
        $flag = ( !file_exists($this->dbDir.DIRECTORY_SEPARATOR.$this->dbName.'.db') ? true : false );

        /** create the connection **/
        $this->pdo = new PDO('sqlite:'.$this->dbDir.DIRECTORY_SEPARATOR.$this->dbName.'.db');

        /** set up database **/
        if ($flag == true) {
            $this->initializeDB();
        }

    }

    /** @method prevent duplication of this object
      * @param  void
      * @return void **/
    public function __clone() { }

    /** @method initialize database (create/populate indexes/tables)
      * @param  void
      * @return void **/
    protected function initializeDB()
    {
        // if you do not override this, nothing will happen
    }

    /** @method fetch records
      * @param  *str* SQL Statement
      * @return *arr* array of assocs (or false) **/
    public function fetchRecs($sql)
    {
        /** make sure we have a result **/
        if ($result = $this->pdo->query($sql, PDO::FETCH_ASSOC)) {

            /** initialize array for records to return **/
            $recs = array();

            /** add the records from result **/
            foreach ($result as $rec) {
                $recs[] = $rec;
            }

            /** make sure we are not returning an empty array **/
            if (count($recs) > 0) {
                return $recs;
            } else {
                return false;
            }

        } else {
            return false;
        }
    }

    /** @method executes an SQL Statement
      * @param  *str* SQL Statement
      * @return *int* affected rows (or false) **/
    public function executeSQL($sql)
    {
        return $this->pdo->exec($sql);
    }

    /** @method passthru of PDO method
      * @param  void
      * @return void **/
    public function lastInsertId()
    {
        return $this->pdo->lastInsertId();
    }

}

Create Abstract Database Connection Class.


<?php

namespace Tests\SlackAPI\Events;

use PHPUnit\Framework\TestCase;
use SlackPHP\SlackAPI\Events\ParsedReceivedEvent;
use SlackPHP\SlackAPI\Models\Methods\GroupsListResponse;

/**
 * @author Dzianis Zhaunerchyk <dzhaunerchyk@gmail.com>
 * @covers ParsedReceivedEvent
 */
class ParsedReceivedEventTest extends TestCase
{
    /**
     * Test setting payloadResponse
     */
    public function testSettingPayloadResponse()
    {
        $payloadResponse = new GroupsListResponse();
        $parsedReceivedEventObject = new ParsedReceivedEvent();
        $returnedObject = $parsedReceivedEventObject->setPayloadResponse($payloadResponse);
        $refParsedReceivedEventObject = new \ReflectionObject($parsedReceivedEventObject);
        $payloadResponseProperty = $refParsedReceivedEventObject->getProperty('payloadResponse');
        $payloadResponseProperty->setAccessible(true);
        $this->assertInstanceOf(GroupsListResponse::class, $payloadResponseProperty->getValue($parsedReceivedEventObject));
        $this->assertInstanceOf(ParsedReceivedEvent::class, $returnedObject);
    }
}

Test for set parsedReceivedPayload event


<?php

namespace Frontend\Modules\Profiles\Tests\Engine;

use Common\WebTestCase;
use DateTime;
use Frontend\Core\Engine\Model as FrontendModel;
use Frontend\Modules\Profiles\Engine\Authentication;
use SpoonDatabase;

final class AuthenticationTest extends WebTestCase
{
    public function setUp(): void
    {
        parent::setUp();

        if (!defined('APPLICATION')) {
            define('APPLICATION', 'Frontend');
        }

        $client = self::createClient();
        $this->loadFixtures($client);
    }

    public function testOldSessionCleanUp()
    {
        $dateWithinAMonthAgo = new DateTime('-1 week');
        $dateOverAMonthAgo = new DateTime('-2 months');

        /** @var SpoonDatabase $database */
        $database = FrontendModel::get('database');

        $database->insert(
            'profiles_sessions',
            [
                [
                    'session_id' => '0123456789',
                    'profile_id' => 1,
                    'secret_key' => 'NotSoSecretNowIsIt',
                    'date' => $dateWithinAMonthAgo->format('Y-m-d H:i:s'),
                ],
                [
                    'session_id' => '1234567890',
                    'profile_id' => 1,
                    'secret_key' => 'WeNeedToTalk',
                    'date' => $dateOverAMonthAgo->format('Y-m-d H:i:s'),
                ],
            ]
        );

        $this->assertEquals('2', $database->getVar('SELECT COUNT(session_id) FROM profiles_sessions'));

        Authentication::cleanupOldSessions();

        $this->assertEquals('1', $database->getVar('SELECT COUNT(session_id) FROM profiles_sessions'));
    }
}

Test the cleanup of old sessions

Test the cleanup of old sessions


<?php

class Basics {

  static function id($a) {
    return $a;
  }

  static function constant($a, $b) {
    return $a;
  }

  static function curry2(callable $f) {
    return function ($a) use ($f) {
      return function ($b) use ($f, $a) {
        return $f($a, $b);
      };
    };
  }

  static function curry3(callable $f) {
    return function ($a) use ($f) {
      return function ($b) use ($f, $a) {
        return function ($c) use ($f, $a, $b) {
          return $f($a, $b, $c);
        };
      };
    };
  }

}

Add module for basic FP utilities (currying, id, etc)


<?php

class Migration_1488794963_RemoveDbUpdate implements \CM_Migration_UpgradableInterface, \CM_Service_ManagerAwareInterface {

    use CM_Service_ManagerAwareTrait;

    public function up(\CM_OutputStream_Interface $output) {
        if (0 !== CM_Db_Db::count('cm_option', '`key` lIKE "app.version%"')) {
            $output->writeln('- remove cm_option app.version* entries');
            CM_Db_Db::delete('cm_option', '`key` lIKE "app.version%"');
        }
    }
}

Remove db update version in db

Remove db update version in db


<?php
namespace Icicle\Concurrent\Sync;

use Icicle\Concurrent\Exception\SemaphoreException;

/**
 * A wrapper for a semaphore based on the "sync" extension.
 */
class ExtSyncSemaphore implements SemaphoreInterface
{
    /**
     * @var \SyncSemaphore A semaphore instance.
     */
    private $semaphore;

    /**
     * Creates a new semaphore object.
     *
     * @param int $maxLocks The maximum number of processes that can lock the semaphore.
     */
    public function __construct($maxLocks = 1)
    {
        $this->semaphore = new \SyncSemaphore(null, $maxLocks);
    }

    /**
     * {@inheritdoc}
     */
    public function lock()
    {
        $this->semaphore->lock(-1);
    }

    /**
     * {@inheritdoc}
     */
    public function unlock()
    {
        $this->semaphore->unlock();
    }
}

Add semaphore from sync extension

Add semaphore from sync extension


<?php namespace Illuminate\Events;

use Illuminate\Support\ServiceProvider;
use Illuminate\Contracts\Events\Dispatcher as DispatcherContract;

class ListenerServiceProvider extends ServiceProvider {

	/**
	 * Register the application's event listeners.
	 *
	 * @param  \Illuminate\Contracts\Events\Dispatcher  $events
	 * @return void
	 */
	public function boot(DispatcherContract $events)
	{
		foreach ($this->listen as $event => $listeners)
		{
			foreach ($listeners as $listener)
			{
				$events->listen($event, $listener);
			}
		}
	}

	/**
	 * {@inheritdoc}
	 */
	public function register()
	{
		//
	}

}

Add a listener service provider.

Add a listener service provider.


<?php declare(strict_types=1);

namespace hollodotme\Readis\Application\ReadModel\KeyDataBuilders;

use hollodotme\Readis\Application\Interfaces\ProvidesKeyInfo;
use hollodotme\Readis\Application\ReadModel\Constants\KeyType;
use hollodotme\Readis\Application\ReadModel\DTO\KeyData;
use hollodotme\Readis\Application\ReadModel\Interfaces\BuildsKeyData;
use hollodotme\Readis\Application\ReadModel\Interfaces\PrettifiesString;
use hollodotme\Readis\Application\ReadModel\Interfaces\ProvidesKeyData;
use hollodotme\Readis\Application\ReadModel\Interfaces\ProvidesKeyName;
use hollodotme\Readis\Infrastructure\Redis\Exceptions\ConnectionFailedException;
use hollodotme\Readis\Infrastructure\Redis\ServerManager;

final class StringKeyDataBuilder implements BuildsKeyData
{
	/** @var ServerManager */
	private $manager;

	/** @var PrettifiesString */
	private $prettifier;

	public function __construct( ServerManager $manager, PrettifiesString $prettifier )
	{
		$this->manager    = $manager;
		$this->prettifier = $prettifier;
	}

	public function canBuildKeyData( ProvidesKeyInfo $keyInfo, ProvidesKeyName $keyName ) : bool
	{
		return !$keyName->hasSubKey() && (KeyType::STRING === $keyInfo->getType());
	}

	/**
	 * @param ProvidesKeyInfo $keyInfo
	 * @param ProvidesKeyName $keyName
	 *
	 * @throws ConnectionFailedException
	 * @return ProvidesKeyData
	 */
	public function buildKeyData( ProvidesKeyInfo $keyInfo, ProvidesKeyName $keyName ) : ProvidesKeyData
	{
		$rawKeyData = $this->manager->getValue( $keyName->getKeyName() ) ?: '';
		$keyData    = $this->prettifier->prettify( $rawKeyData );

		return new KeyData( $keyData, $rawKeyData );
	}
}

Add string key data builder

Add string key data builder


<?php

namespace PhpAbac\Manager;

use Psr\Cache\CacheItemInterface;

class CacheManager {
    /** @var string **/
    protected $defaultDriver = 'memory';
    /** @var array **/
    protected $pools;

    /**
     * @param \Psr\Cache\CacheItemInterface $item
     */
    public function save(CacheItemInterface $item) {
        $this->getItemPool($item->getDriver())->save($item);
    }

    /**
     * @param string $key
     * @param string $driver
     * @param int $ttl
     * @return \Psr\Cache\CacheItemInterface
     */
    public function getItem($key, $driver = null, $ttl = null) {
        $finalDriver = ($driver !== null) ? $driver : $this->defaultDriver;

        $pool = $this->getItemPool($finalDriver);
        $item = $pool->getItem($key);

        // In this case, the pool returned a new CacheItem
        if($item->get() === null) {
            $item->expiresAfter($ttl);
        }
        return $item;
    }

    /**
     *
     * @param string $driver
     * @return Psr\Cache\CacheItemPoolInterface
     */
    public function getItemPool($driver) {
        if(!isset($this->pools[$driver])) {
            $poolClass = 'PhpAbac\\Cache\\Pool\\' . ucfirst($driver) . 'CacheItemPool';
            $this->pools[$driver] = new $poolClass();
        }
        return $this->pools[$driver];
    }
}

Implement cache manager to handle the PSR-6 drivers


<?php
/*
 * PixLab PHP Client which is just a single class PHP file without any dependency that you can get from Github
 * https://github.com/symisc/pixlab-php
 */
require_once "pixlab.php";
/*
 * Remove a previously stored media file. All your processed media files are stored by default on pixlab.xyz unless you set your own AWS S3 key (refer to your dashboard on how to do that). In which case, everything shall be stored on your own S3 bucket.
 * Refer to https://pixlab.io/cmd?id=delete for more info.
 */
# Your PixLab key
$key = 'My_Pixlab_Key';

$pix = new Pixlab($key);
if( !$pix->get('delete',array(
		'link'=>'http://media.pixlab.xyz/24p5e554681b9884.png'
	))){
	echo $pix->get_error_message();
	die;
}
echo "Deletion succeed";

?>

Delete a file stored on the PixLab storage server


<?php

use Galahad\LaravelAddressing\Country;
use Galahad\LaravelAddressing\Locality;

/**
 * Class LocalityTest
 *
 * @author Junior Grossi <juniorgro@gmail.com>
 */
class LocalityTest extends PHPUnit_Framework_TestCase
{
    public function testBeloHorizonteCity()
    {
        $brazil = (new Country)->getByCode('BR');
        $states = $brazil->getAdministrativeAreas();
        $minasGerais = $states->getByCode('MG');
        $beloHorizonte = $minasGerais->getLocalities()->getByName('Belo Horizonte');

        $this->assertEquals($beloHorizonte->getAdministrativeArea()->getName(), 'Minas Gerais');
        $this->assertEquals($beloHorizonte->getName(), 'Belo Horizonte');
        $this->assertInstanceOf(Locality::class, $beloHorizonte);
    }

    public function testBoulderCity()
    {
        $colorado = (new Country)->getByCode('US')->getAdministrativeAreas()->getByName('Colorado');

        $this->assertEquals($colorado->getLocalities()->getByName('Boulder'), 'Boulder');
    }
}

Add tests for Locality class

Add tests for Locality class


<?php
namespace App\Test\TestCase\Controller;

use App\Test\TestCase\Controller\TatoebaControllerTestTrait;
use Cake\Core\Configure;
use Cake\TestSuite\IntegrationTestCase;

class StatsControllerTest extends IntegrationTestCase
{
    use TatoebaControllerTestTrait;

    public $fixtures = [
        'app.private_messages',
        'app.users',
        'app.languages',
        'app.sentences',
        'app.users_languages',
    ];

    public function setUp() {
        parent::setUp();
        Configure::write('Acl.database', 'test');
    }

    public function accessesProvider() {
        return [
            // url; user; is accessible or redirection url
            [ '/eng/stats/sentences_by_language', null, true ],
            [ '/eng/stats/sentences_by_language', 'contributor', true ],
            [ '/eng/stats/users_languages', null, true ],
            [ '/eng/stats/users_languages', 'contributor', true ],
            [ '/eng/stats/native_speakers', null, true ],
            [ '/eng/stats/native_speakers', 'contributor', true ],
        ];
    }

    /**
     * @dataProvider accessesProvider
     */
    public function testControllerAccess($url, $user, $response) {
        $this->assertAccessUrlAs($url, $user, $response);
    }
}

Add tests for accessing the Stats controller


<?php if ( ! defined('BASEPATH')) exit('Invalid file request');

/**
 * Pickr number helper methods.
 *
 * @package			Pickr
 * @author 			Stephen Lewis <stephen@experienceinternet.co.uk>
 * @copyright 		Experience Internet
 * @version 		0.1.0
 */

if ( ! function_exists('valid_database_id'))
{
	/**
	 * Returns whether the supplied argument is a number or string
	 * that may be interpreted as a positive integer.
	 *
	 * @access	private
	 * @param	mixed		$val		The value to test.
	 * @return	bool
	 */
	function valid_database_id($val)
	{
		return ($val && is_numeric($val) && intval($val) == $val);
	}
}

/* End of file 		: pickr_number_helper.php */
/* File location	: third_party/pickr/helpers/pickr_number_helper.php */

Create new 'number_helper', to house 'valid_database_id' check.


<?php

/**
 * USPS address standardization interface.
 *
 * A simple class to interface with the USPS's API to verify addresses.
 *
 * Created by Joe Riggs, who released this under no specified license terms. IT can be found at:
 *
 * http://joe-riggs.com/blog/2009/10/address-standardization-verification-with-usps-web-tools-and-php/
 */
class USPS {

	public $account = 'xxxxxxx'; //you need to register for this
	public $url = 'http://production.shippingapis.com/ShippingAPI.dll';
	public $address1, $address2, $city, $state, $zip;
	public $ship_address1, $ship_address2, $ship_city, $ship_state, $ship_zip;

	function toXML()
	{
		$xml = ' <AddressValidateRequest USERID="' . $this->account . '"><Address ID="1">';
		$xml .= '<Address1>' . $this->address1 . '</Address1>';
		$xml .= '<Address2>' . $this->address2 . '</Address2>';
		$xml .= '<City>' . $this->city . '</City>';
		$xml .= '<State>' . $this->state . '</State>';
		$xml .= '<Zip5>' . $this->zip . '</Zip5>';
		$xml .= '<Zip4></Zip4></Address>';
		$xml .= '</AddressValidateRequest>';

    	return $xml;
     }

	function submit_request()
	{

		$ch = curl_init($this->url);
		curl_setopt($ch, CURLOPT_POST, 1);
		curl_setopt($ch, CURLOPT_POSTFIELDS, "API=Verify&XML=" . $this->toXML());
		curl_setopt($ch, CURLOPT_TIMEOUT, 60);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
		//curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);

		$result = curl_exec($ch);
		$error = curl_error($ch);

		if (!empty($error))
		{
			return $result;
		}
		else
		{
			die(curl_error($ch));
		}

	}

}

Include a class to interface with the USPS's API

This will allow us to normalize addresses.


<?php declare(strict_types=1);

namespace Becklyn\RadBundle\tests\Pagination;

use Becklyn\RadBundle\Pagination\PaginatedList;
use Becklyn\RadBundle\Pagination\Pagination;
use PHPUnit\Framework\TestCase;

class PaginatedListTest extends TestCase
{
    public function testAccessors () : void
    {
        $pagination = new Pagination(1, 10);
        $list = [1,2,3];

        $paginatedList = new PaginatedList($list, $pagination);

        self::assertSame($list, $paginatedList->getList());
        self::assertSame($pagination, $paginatedList->getPagination());
    }
}

Add tests for paginated list

Add tests for paginated list


<?php

namespace Jivoo\Models;

class DataTypeTest extends \Jivoo\Test {

  protected function _before() {}

  protected function _after() {}

  public function testDetectType() {
    $this->assertTrue(DataType::detectType(true)->isBoolean());
    $this->assertTrue(DataType::detectType(false)->isBoolean());
    $this->assertTrue(DataType::detectType(132)->isInteger());
    $this->assertTrue(DataType::detectType(132.2)->isFloat());
    $this->assertTrue(DataType::detectType(array(1))->isObject());
    $this->assertTrue(DataType::detectType((object)array('a' => 2))->isObject());
    $this->assertTrue(DataType::detectType('foo')->isText());
  }
}

Add data type unit test.

Add data type unit test.


<?php

namespace App\Http\Middleware;

use Closure;
use Symfony\Component\HttpFoundation\Response;

/**
 * A middleware that determines the response
 * format that is preferred by the client.
 */
class NegotiateContent
{
    /**
     * A list of response content types supported by the different routes.
     *
     * @var array
     */
    protected $availableContentTypesForPaths = [
        'assemblies' => [
            'application/json',
            'text/csv',
            'text/html',
            'text/xml',
        ],
        'assemblies/.+' => [
            'application/json',
            'text/csv',
            'text/html',
            'text/xml',
        ],
    ];

    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     *
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        $this->initializeFormats($request);

        // Find what are the available media types for the current request.
        $availableTypes = $this->getAvailableTypes($request->path());

        $acceptedType = $request->prefers($availableTypes);

        // If we cannot provide the resource in any of the formats
        // that are accepted by the client, we abort the request.
        if ($acceptedType) {
            abort(
                Response::HTTP_NOT_ACCEPTABLE,
                'The supported formats are: '.implode(', ', $availableTypes).'.'
            );
        }

        // Register the accepted format on the request object to make
        // this info available to subsequent code or middleware.
        $request->setRequestFormat(
            $request->getFormat($acceptedType)
        );

        return $next($request);
    }

    /**
     * Register supported formats that the Symfony request doesn’t know about.
     *
     * @param  \Illuminate\Http\Request  $request
     *
     * @return void
     */
    protected function initializeFormats($request)
    {
        $request->setFormat('csv', 'text/csv');
    }

    /**
     * Find what are the available media types for the current request.
     *
     * @param  string  $path  The path of the current request
     *
     * @return array
     */
    protected function getAvailableTypes($path)
    {
        $paths = array_reverse($this->availableContentTypesForPaths);

        foreach ($paths as $path => $availableContentTypes) {
            if (preg_match("!{$path}!", $path)) {
                return $availableContentTypes;
            }
        }

        return [];
    }
}

Add middleware for content negotiation

Add middleware for content negotiation

In case the content negotiation fails (because none of the formats we support is accepted), an `HTTP 406 Not acceptable` response is sent, listing the content types we support.


<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class ChangeTypeOfScrPeriodInCourses extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('courses', function (Blueprint $table) {
            $table->text('scr_period')->nullable()->comment('上課時間/上課教室/授課教師')->change();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('courses', function (Blueprint $table) {
            $table->string('scr_period')->default('')->comment('上課時間/上課教室/授課教師')->change();
        });
    }
}

Change type of scr_period of Course

Change type of scr_period of Course


<?php
/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2016 Bruno P. Kinoshita, Peter Florijn
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of
 * this software and associated documentation files (the "Software"), to deal in
 * the Software without restriction, including without limitation the rights to
 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
 * the Software, and to permit persons to whom the Software is furnished to do so,
 * subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

namespace Controllers;

use \TestCase;
use Illuminate\Foundation\Testing\DatabaseTransactions;

class ExecutionTypesControllerTest extends TestCase
{

    use DatabaseTransactions;

    public function testGetIndex()
    {
        $dispatcher = $this->app->make('Dingo\Api\Dispatcher');

        $response = $dispatcher->get('executiontypes', []);

        $this->assertEquals(2, count($response));
    }
}

Add execution types controller tests

Add execution types controller tests


<?php

namespace Risan\OAuth1;

interface ConfigInterface
{
    /**
     * Get the ClientCredentials instance.
     *
     * @return \Risan\OAuth1\Credentials\ClientCredentials
     */
    public function getClientCredentials();

    /**
     * Get the client credentials identifer.
     *
     * @return string
     */
    public function getClientCredentialsIdentifier();

    /**
     * Get the client credentials secret.
     *
     * @return string
     */
    public function getClientCredentialsSecret();

    /**
     * Check if callback URI is set.
     *
     * @return boolean
     */
    public function hasCallbackUri();

    /**
     * Get the callback URI.
     *
     * @return string|null
     */
    public function getCallbackUri();

    /**
     * Get the URL for obtaining temporary credentials. Also known as request
     * token url.
     *
     * @return string
     */
    public function getTemporaryCredentialsUrl();

    /**
     * Create an instance of ConfigureInterface from array.
     *
     * @return \Risan\OAuth1\ConfigInterface
     * @throws \InvalidArgumentException
     */
    public static function createFromArray(array $config);
}

Add new interface for config.

:sparkles: Add new interface for config.


<?php

namespace Application\Migrations;

use Doctrine\DBAL\Migrations\AbstractMigration,
    Doctrine\DBAL\Schema\Schema;

/**
 * Auto-generated Migration: Please modify to your need!
 */
class Version20121019192104 extends AbstractMigration
{
    public function up(Schema $schema)
    {
        $this->addSql('CREATE SEQUENCE atlas_object_status_id_seq INCREMENT BY 1 MINVALUE 1 START 1;');
        $this->addSql('CREATE TABLE atlas_object_status (id INT NOT NULL, title VARCHAR(255) NOT NULL, action_title VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id));');
        $this->addSql('ALTER TABLE atlas_object ADD created_by INT DEFAULT NULL;');
        $this->addSql('ALTER TABLE atlas_object ADD updated_by INT DEFAULT NULL;');
        $this->addSql('ALTER TABLE atlas_object ADD status INT DEFAULT NULL;');
        $this->addSql('ALTER TABLE atlas_object ADD created_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL;');
        $this->addSql('ALTER TABLE atlas_object ADD updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL;');
        $this->addSql('ALTER TABLE atlas_object ADD is_official BOOLEAN DEFAULT NULL;');
        $this->addSql('ALTER TABLE atlas_object ADD reason TEXT DEFAULT NULL;');
        $this->addSql('ALTER TABLE atlas_object ADD CONSTRAINT FK_E837B302DE12AB56 FOREIGN KEY (created_by) REFERENCES fos_user_user (id) NOT DEFERRABLE INITIALLY IMMEDIATE;');
        $this->addSql('ALTER TABLE atlas_object ADD CONSTRAINT FK_E837B30216FE72E1 FOREIGN KEY (updated_by) REFERENCES fos_user_user (id) NOT DEFERRABLE INITIALLY IMMEDIATE;');
        $this->addSql('ALTER TABLE atlas_object ADD CONSTRAINT FK_E837B3027B00651C FOREIGN KEY (status) REFERENCES atlas_object_status (id) NOT DEFERRABLE INITIALLY IMMEDIATE;');
        $this->addSql('CREATE INDEX IDX_E837B302DE12AB56 ON atlas_object (created_by);');
        $this->addSql('CREATE INDEX IDX_E837B30216FE72E1 ON atlas_object (updated_by);');
        $this->addSql('CREATE INDEX IDX_E837B3027B00651C ON atlas_object (status)');

        // this up() migration is autogenerated, please modify it to your needs

    }

    public function down(Schema $schema)
    {
        // this down() migration is autogenerated, please modify it to your needs

    }
}

Add migration for atlas changes

[*] Add migration for atlas changes


<?php

namespace Tests\Functional\BackendBundle\Controller;

use Tests\Functional\WebTestCase;

class TeamAddRepositoryControllerTest extends WebTestCase
{
    public function testRepositoriesCanNotBeSearchedByAnonymous()
    {
        $client = static::createClient();
        $client->request('GET', '/backend/teams/repositories');

        $this->assertTrue($client->getResponse()->isRedirect('/login'));
    }

    /**
     * @dataProvider searchProvider
     */
    public function testRepositoriesCanBeSearched($search, $expectedRepoIdentifiers)
    {
        $client = static::createClient();
        $this->logIn($client, 'user');

        $client->request('GET', '/backend/teams/repositories', [
            'q' => $search
        ]);

        $this->assertTrue($client->getResponse()->isSuccessful());
        $this->assertEquals('application/json', $client->getResponse()->headers->get('Content-Type'));

        $results = json_decode($client->getResponse()->getContent(), true);
        $identifiers = array_column($results['repositories'], 'identifier');

        $this->assertEquals($expectedRepoIdentifiers, $identifiers);
    }

    public function searchProvider()
    {
        return [
            [ '', [] ],
            [ 'github', ['github/test'] ],
            [ 'git', ['github/test'] ],
            [ 'test', ['github/test'] ],
        ];
    }
}

Add a few functional tests for the repository search controller


<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateDigitalLabelsExhibitionsTables extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('digital_label_exhibitions', function (Blueprint $table) {
            $table = $this->_addIdsAndTitle($table);
            $table->integer('exhibition_citi_id');
            $table->string('color');
            $table->string('background_color');
            $table->boolean('published');
            $table = $this->_addDates($table);
        });

        Schema::create('digital_labels', function (Blueprint $table) {
            $table = $this->_addIdsAndTitle($table);
            $table->integer('digital_label_exhibition_id');
            $table->string('type');
            $table->text('copy_text');
            $table->string('image_url');
            $table->boolean('published');
            $table = $this->_addDates($table);
        });

        Schema::create('artwork_digital_label', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('digital_label_id')->unsigned()->index();
            $table->integer('artwork_citi_id')->index();
        });

        Schema::create('artist_digital_label', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('digital_label_id')->unsigned()->index();
            $table->integer('agent_citi_id')->index();
        });
}

    private function _addIdsAndTitle($table)
    {
        $table->integer('id')->unsigned()->unique()->primary();
        $table->string('title');
        return $table;
    }

    private function _addDates($table, $citiField = true)
    {
        $table->timestamp('source_created_at')->nullable()->useCurrent();
        $table->timestamp('source_modified_at')->nullable()->useCurrent();
        $table->timestamps();
        return $table;
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('digital_labels_exhibitions');
        Schema::dropIfExists('digital_labels');
        Schema::dropIfExists('artwork_digital_label');
        Schema::dropIfExists('artist_digital_label');
    }
}

Create digital labels database table

Create digital labels database table


<?php

namespace Mimic\Test;

use PHPUnit_Framework_TestCase;
use Mimic\Functional as F;

/**
 * Unit Test for pluck Mimic library function.
 *
 * @since 0.1.0
 */
class PluckFuncTest extends PHPUnit_Framework_TestCase {
	public function dataProvider() {
		$collection = array(
			array('index1' => 1, 'index2' => 2, 'index3' => 3),
			array('index1' => 4, 'index2' => 5, 'index3' => 6),
			array('index1' => 7, 'index2' => 8, 'index3' => 9),
		);

		$first = new Fake\InvokeTrue;
		$first->one = 1;
		$first->two = 2;
		$first->something = 1;

		$second = new Fake\InvokeTrue;
		$second->one = 3;
		$second->two = 4;
		$second->something = 2;

		$three = new Fake\InvokeTrue;
		$three->one = 5;
		$three->two = 6;
		$three->something = 3;

		$objects = array($first, $second, $three);

		return array(
			array($collection, array(1, 4, 7), 'index1'),
			array($collection, array(2, 5, 8), 'index2'),
			array($collection, array(3, 6, 9), 'index3'),
			array($collection, array(), 'index4'),
			array($objects, array(), 'hello'),
			array($objects, array(1, 3, 5), 'one'),
			array($objects, array(2, 4, 6), 'two'),
			array($objects, array(1, 2, 3), 'something'),
		);
	}

	/**
	 * @dataProvider dataProvider
	 * @covers ::Mimic\Functional\pluck
	 */
	public function testResults($collection, $expected, $name) {
		$this->assertEquals($expected, F\pluck($collection, $name));
	}
}

Add pluck function test suite.

Add pluck function test suite.


<?php
/**
 * Send an HTTP request.
 * @param  string $method
 * @param  string $url
 * @param  array $bodyData
 * @return string|bool
 */
function send_request($method, $url, array $bodyData = [])
{
    $context = stream_context_create([
        'http' => [
            'method'  => $method,
            'header'  => 'Content-type: application/x-www-form-urlencoded',
            'content' => http_build_query($bodyData),
        ],
    ]);
    return file_get_contents($url, null, $context);
}

// Get the server name from the environment.
$host = getenv('COUCHBASE_SERVER_HOST');

// Wait for server initialization.
echo 'Waiting for server initialization...';
$startTime = time();
while (true) {
    $fp = @ fsockopen($host, 8091, $errno, $errstr);
    if (false !== $fp) {
        fclose($fp);
        echo "DONE\n";
        break;
    }
    if (time() - $startTime >= 60) {
        echo "\nCannot connect to the couchbase server. ({$errstr})\n";
        exit(1);
    }
    sleep(1);
    echo '.';
}

// Setup index and memory quota.
send_request(
    'POST',
    "http://{$host}:8091/pools/default",
    ['memoryQuota' => 300]
);
// Setup services.
send_request(
    'POST',
    "http://{$host}:8091/node/controller/setupServices",
    ['services' => 'kv']
);
// Setup credentials.
send_request(
    'POST',
    "http://{$host}:8091/settings/web",
    [
        'username' => 'Administrator',
        'password' => 'password',
        'port'     => 'SAME',
    ]
);

// Create the test bucket.
send_request(
    'POST',
    "http://Administrator:password@{$host}:8091/pools/default/buckets",
    [
        'name'          => 'test',
        'authType'      => 'none',
        'bucketType'    => 'couchbase',
        'proxyPort'     => 11212,
        'ramQuotaMB'    => 100,
        'replicaIndex'  => 0,
        'replicaNumber' => 0,
    ]
);

// Wait for bucket initialization.
echo 'Waiting for bucket initialization...';
$startTime = time();
while (true) {
    $fp = @ fopen("http://{$host}:8091/pools/default/buckets/test", 'r');
    if (false !== $fp) {
        fclose($fp);
        echo "DONE\n";
        break;
    }
    if (time() - $startTime >= 60) {
        echo "\nCannot connect to the couchbase bucket. ({$http_response_header[0]})\n";
        exit(1);
    }
    sleep(1);
    echo '.';
}

Add script to configure the test server.


<?php
/**
 * Created by PhpStorm.
 * User: faramarz
 * Date: 1/16/17
 * Time: 12:57
 */

namespace FSalehpour\PersianToolkit;

class SampleClass
{

}

Add src folder with Sample class code

Add src folder with Sample class code


<?php
/**
 * Plugin Name: E2E Survey Trigger Interception
 * Description: REST Endpoint for bypassing survey trigger requests to the Site Kit service during E2E tests.
 *
 * @package   Google\Site_Kit
 * @copyright 2021 Google LLC
 * @license   https://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
 * @link      https://sitekit.withgoogle.com
 */

use Google\Site_Kit\Core\REST_API\REST_Routes;

add_action(
	'rest_api_init',
	function () {
		if ( ! defined( 'GOOGLESITEKIT_PLUGIN_MAIN_FILE' ) ) {
			return;
		}

		register_rest_route(
			REST_Routes::REST_ROOT,
			'core/user/data/survey-trigger',
			array(
				'methods'             => WP_REST_Server::EDITABLE,
				'callback'            => function ( WP_REST_Request $request ) {
					return array(
						'session'                    => null,
						'survey_payload'             => null,
						'no_available_survey_reason' => 'The available survey has already been completed or dismissed.',
						'survey_id'                  => '',
					);
				},
				'permission_callback' => '__return_true',
			),
			true
		);
	},
	0
);

Add survey trigger endpoint handler for E2E.


<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class DropLakeUriFromAllTables extends Migration
{

    private $tables = [
        'artwork_date_qualifiers',
        'artwork_dates',
    ];

    public function up()
    {
        foreach ($this->tables as $tableName) {
            Schema::table($tableName, function (Blueprint $table) use ($tableName) {
                if (Schema::hasColumn($tableName, 'lake_uri')) {
                    $table->dropColumn('lake_uri');
                }
            });
        }
    }

    public function down()
    {
        $this->up();

        foreach ($this->tables as $tableName) {
            Schema::table($tableName, function (Blueprint $table) use ($tableName) {
                // This should be a text...
                $table->string('lake_uri')->unique()->nullable()->after('title');
            });
        }
    }
}

Drop `lake_uri` from all tables

Drop `lake_uri` from all tables

We shouldn't be storing this in the database, since it can be generated
using `lake_guid`. In either case, these two resources are no longer
being retrieved from the LAKE API, but rather, from CITI's API, so
these fields will become stale very soon.


<?php

class ExceptionTest extends PHPUnit_Framework_TestCase
{
  /**
   * @test
   *
   * @covers  Getopti\Exception
   *
   * @author  Braden Schaeffer
   */
  public function does_something()
  {

  }

  public function exception_class_exists()
  {
    $this->assertTrue(class_exists('Getopti\\Exception'));
    $this->assertInstanceOf('Exception', new Getopti\Exception);
  }
}

/* End of file ExceptionTest.php */
/* Location: ./Test/Getopti/ExceptionTest.php */

Add Exception class exists test (simple stuff)


<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AddUniqueSiteVersionPathIndexOnPages extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('pages', function (Blueprint $table) {
            $table->unique(['site_id', 'version', 'path'], 'idx_site_id_version_path2');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('pages', function (Blueprint $table) {
            $table->dropUnique('idx_site_id_version_path2');
        });
    }
}

Add unique index to stop two pages with same path existing.

Enforces at database level the condition that paths must be unique for a version of a site.

Matthew and Sam can confirm the need for this...

Could alternately have enforced this on site_id, parent_id, version and slug.


<?php

declare(strict_types=1);

namespace OCA\B2shareBridge\Migration;

use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\Migration\SimpleMigrationStep;
use OCP\Migration\IOutput;

class Version010100Date20200130114400 extends SimpleMigrationStep {

    /** @var IDBConnection */
    protected $connection;

    /** @var IConfig */
    protected $config;

    /**
     * @param IDBConnection $connection
     * @param IConfig $config
     */
    public function __construct(IDBConnection $connection, IConfig $config) {
        $this->connection = $connection;
        $this->config = $config;
    }

	/**
	 * @param IOutput $output
	 * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
	 * @param array $options
	 * @return null|ISchemaWrapper
	 */
	public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
		/** @var ISchemaWrapper $schema */
		$schema = $schemaClosure();

		if (!$schema->hasTable('b2sharebridge_server')) {
			$table = $schema->createTable('b2sharebridge_server');
			$table->addColumn('id', 'bigint', [
				'autoincrement' => true,
				'notnull' => true,
				'length' => 64,
			]);
			$table->addColumn('name', 'string', [
				'notnull' => true,
				'length' => 64,
				'default' => '',
			]);
			$table->addColumn('publish_url', 'string', [
				'notnull' => true,
                'length' => 64,
                'default' => '',
			]);
		}
		return $schema;
	}

}

Add migration script to create new database table for b2share servers


<?php

include_once "../www/includes/easyparliament/init.php";

$db = new ParlDB;
$q = $db->query('select hansard.gid,time_to_sec(atime) as atime,hdate,hpos
	from hansard, video_timestamps
	where hansard.gid = video_timestamps.gid
		and (user_id is null or user_id != -1) and deleted=0
	order by hdate, hpos');
$last = array('hdate'=>'');
for ($i=0; $i<$q->rows(); $i++) {
	$row = array(
		'atime' => $q->field($i, 'atime'),
		'hdate' => $q->field($i, 'hdate'),
		'gid' => $q->field($i, 'gid'),
		'hpos' => $q->field($i, 'hpos')
	);
	if ($row['hdate'] != $last['hdate'])
		$last = array();
	if ($last && $row['atime'] < $last['atime']-5) {
		print "PROBLEM; current row is $row[gid] $row[hdate] $row[atime]\n";
		print "  Last was $last[gid] $last[hdate] $last[atime]\n";
	}
	$last = $row;
}

Check timestamps go in order.

Check timestamps go in order.


<?php
/*
Example 23 - Delete a customer from mollie api.
*/

try {
    /*
 * Initialize the Mollie API library with your API key or OAuth access token.
 */
    require "initialize.php";

    $mollie->customers->delete("customer_id");
    echo "Customer deleted!";

} catch (\Mollie\Api\Exceptions\ApiException $e) {
    error_log("API call failed: " . htmlspecialchars($e->getMessage()));
}

Move back the customer delete example

Move back the customer delete example


<?php

use PHPUnit\Framework\TestCase;

class BackwardsCompatibilityTest extends TestCase
{
    public function testScheduleBackwardsCompatibility()
    {
        $teams = ['Team 1', 'Team 2', 'Team 3', 'Team 4', 'Team 5'];
        $this->assertEquals(schedule($teams, 17, false), make_schedule($teams, 17, false));
        $this->assertEquals(schedule($teams, null, true, 16), make_schedule($teams, null, true, 16));
    }
}

Add backwards compatibility test for schedule function


<?php

namespace Kmelia\FreshBundle\Tests;

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

class BaseFunctionalTest extends WebTestCase
{
    public function testIndex()
    {
        $client = static::createClient();

        $crawler = $client->request('GET', '/');

        $this->assertGreaterThan(0, $crawler->filter('html:contains("fresh")')->count());
    }
}

Add base functional test class

Add base functional test class


<?php

namespace WalletLogger;

use Slim\Http\Request;
use Slim\Http\Response;

interface ItemsInterface
{
    public function getItem();

    public function createItem();

    public function updateItem();

    public function deleteItem();

    public function listItems(Request $request, Response $response, Array $args);
}

Define an interface to build items controllers


<?php

/*
 * This file is part of the Doctrine Bundle
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;

use Doctrine\DBAL\Tools\Console\Command\ImportCommand;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

/**
 * Loads an SQL file and executes it.
 *
 * @author Matthias Pigulla <mp@webfactory.de>
 * @author Sebastian Landwehr <sl@webfactory.de>
 */
class ImportDoctrineCommand extends ImportCommand
{
    /**
     * {@inheritDoc}
     */
    protected function configure()
    {
        parent::configure();

        $this
            ->setName('doctrine:database:import')
            ->addOption('connection', null, InputOption::VALUE_OPTIONAL, 'The connection to use for this command');
    }

    /**
     * {@inheritDoc}
     */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        DoctrineCommandHelper::setApplicationConnection($this->getApplication(), $input->getOption('connection'));

        return parent::execute($input, $output);
    }
}

Add doctrine:database:import command to load SQL files

There's already a command for that in Doctrine/DBAL.


<?php

namespace Faker\Test\Provider;

use Faker\Provider\Miscellaneous;

class MiscellaneousTest extends \PHPUnit_Framework_TestCase
{

    public function testBoolean()
    {
        $this->assertContains(Miscellaneous::boolean(), array(true, false));
    }

    public function testMd5()
    {
        $this->assertRegExp('/^[a-z0-9]{32}$/', Miscellaneous::md5());
    }

    public function testSha1()
    {
        $this->assertRegExp('/^[a-z0-9]{40}$/', Miscellaneous::sha1());
    }

    public function testSha256()
    {
        $this->assertRegExp('/^[a-z0-9]{64}$/', Miscellaneous::sha256());
    }

    public function testCountryCode()
    {
        $this->assertRegExp('/^[A-Z]{2}$/', Miscellaneous::countryCode());
    }

    public function testLanguage()
    {
        $this->assertRegExp('/^[a-z]{2}$/', Miscellaneous::languageCode());
    }
}

Add a phpunit test file for the Miscellaneous Provider


<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AddConduitCertificateToUser extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::table('users', function($table)
		{
			$table->text('conduit_certificate');
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::table('users', function($table)
		{
			$table->dropColumn('conduit_certificate');
		});
	}

}

Add migration for user's Conduit certificates.


<?php
require_once("include/verify.php");
require_once("include/funktion.php");
require_once("include/layout.php");
$pdo = db_con();
$zugang = readRegister($pdo);
createUser($pdo, $zugang);
?>

Create an new Account(NEW ADMIN!)

Create an new Account(NEW ADMIN!)


<?php
/**
 * StatusNet, the distributed open-source microblogging tool
 *
 * Plugin to enable LDAP Authentication
 *
 * PHP version 5
 *
 * LICENCE: This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * @category  Plugin
 * @package   StatusNet
 * @author    Craig Andrews <candrews@integralblue.com>
 * @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
 * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
 * @link      http://status.net/
 */

if (!defined('STATUSNET') && !defined('LACONICA')) {
    exit(1);
}

// Dummy file for i18n. Without this file, the strings will not be extracted by
// scripts/update_po_templates.php

Add plugin file to ensure these files are picked up by scripts/update_po_templates.php.


<?php

namespace QuanDigital\LandingPage;

use QuanDigital\WpLib\Boilerplate;
use QuanDigital\WpLib\CreateCpt;
use Noodlehaus\Config;

class Plugin extends Boilerplate
{
    protected $postType = 'landing-page';

    public function __construct($file)
    {
        parent::__construct($file);

        $this->createCpt();
        \add_action('init', [$this, 'registerLanguageTaxonomy'], 20);
        \add_action('init', [$this, 'addRewriteRules']);
        \add_filter('post_type_link', [$this, 'filterPostLink'], 10, 2);
        \add_filter('single_template', [$this, 'registerTemplate']);

        \add_action('wp_enqueue_scripts', [$this, 'registerSubmitScript']);
        \add_action('wp_ajax_submitLp', [$this, 'registerAjax']);
        // \add_action('wp_ajax_submitLp', [new LandingPage(\get_the_id()), 'submitForm']);
    }

    public function createCpt()
    {
        new CreateCpt($this->postType, 'Landing Page', 'Landing Pages', false, ['menu_position' => 20, 'supports' => ['title', 'author', 'revisions',],]);
    }

    public function registerTemplate($template)
    {
        if (\get_post_type(\get_the_id()) === $this->postType) {
            $template = __DIR__ . '/template.php';
        }

        return $template;
    }

    public function addRewriteRules()
    {
        $query = new \WP_Query(['post_type' => $this->postType, 'posts_per_page' => -1]);

        if ($query->have_posts()) {
            while ($query->have_posts()) {
                $query->the_post();

                if ($query->post->post_type == $this->postType) {
                    \add_rewrite_rule('(.*?)$', 'index.php?' . $query->post->post_type . '=$matches[1]', 'top');
                }
            }
        }
    }

    public function filterPostLink($post_link, $post)
    {
        if ($post->post_type === $this->postType && $post->post_status === 'publish') {
            $post_link = str_replace('/' . $post->post_type . '/', '/', $post_link);
        }

        return $post_link;
    }

    public function registerLanguageTaxonomy()
    {
        \register_taxonomy_for_object_type('language', $this->postType);
    }

    public function registerSubmitScript()
    {
        if (\get_post_type(\get_the_id()) === 'landing-page') {
            $thankYou = new Config(__DIR__ . '/config/lang.json');
            wp_enqueue_script('landing-page', \plugin_dir_url(__FILE__) . 'landing-page.js', array('jquery', 'functions'), '', true);
            wp_localize_script('landing-page', 'thankYou', $thankYou->get((new LandingPage(\get_the_id()))->getLanguage(). '.thankyou'));
        }
    }

    public function registerAjax()
    {
        (new LandingPage(\get_the_id()))->submitForm();
    }
}

Handle template, url rewriting and registering ajax action


<?php

namespace eien\Helpers;

use wataridori\SFS\SimpleFuzzySearch;

class BusSearch
{
    public function searchServices($query, Cached $cached)
    {
        $serviceObject = $cached->getAsArray('bus-services');

        $sfs = new SimpleFuzzySearch($serviceObject['services'], ['name']);
        $results = $sfs->search($query);

        return $results;
    }

    public function searchStops($query, Cached $cached)
    {
        $stopObject = $cached->getAsArray('bus-stops');

        $sfs = new SimpleFuzzySearch($stopObject, [
            'name',
            'no',
        ]);
        $results = $sfs->search($query);

        return $results;
    }
}

Move fuzzy search core into it's own class


<?php
$fruits = array("d" => "lemon", "a" => "orange", "b" => "banana", "c" => "apple");
asort($fruits);
foreach ($fruits as $key => $val) {
    echo "$key = $val\n";
}
?>

Sort an array and maintain index association


<?php namespace Katana\Helpers;

class ConfigTest extends \PHPUnit_Framework_TestCase {

	/**
	 * Tests the value of the configuration values.
	 */
	public function testConstsValues(){
		$this->assertEquals( 'intermediate_image_sizes', Config::WP_FILTER );
		$this->assertEquals( 'katana_refine', Config::KATANA_FILTER );
		$this->assertEquals( 'katana', Config::KATANA );
	}
}

Add small test for the const values

Add small test for the const values


<?php
/*
 * Copyright (C) 2015, BMW Car IT GmbH
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
 */

$scenario->group('general');

$I = new UIGuy($scenario);
$I->amOnPage('/');
$I->waitForText('Welcome to komenco');

?>

Add test to generate resources

tests: Add test to generate resources

Resource generation of the ui is triggered on the first access. This test
access the main page to trigger this generation. After this test all
resources are available and no delay during accessing further pages should
take place.


<?php namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class ApiKey extends Model {

    /**
     * The attributes that should be casted to native types.
     * @var array
     */
    protected $casts = [
        'api_key_id' => 'string'
    ];

    /**
     * The database table used by the model.
     * @var string
     */
    protected $table = 'api_keys';

    /**
     * Primary key of the model.
     * @var string
     */
    protected $primaryKey = 'api_key_id';

    /**
     * Disable timestamps functionality.
     * @var boolean
     */
    public $timestamps = false;

    public function creator()
    {
        return $this->belongsTo('App\Models\User', 'users', 'user_id', 'user_id');
    }

    public function generateKey()
    {
        return hash_hmac('sha256', Str::random(128), $this->getKey());
    }
}

Create model for API keys

Create model for API keys


<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AddEmailVerificationFieldsToUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('users', function (Blueprint $table) {
            $table->boolean('email_verified')->default(false)->after('email');
            $table->string('email_verification_token')->after('email_verified')->nullable();

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('users', function (Blueprint $table) {
            $table->dropColumn('email_verified');
            $table->dropColumn('email_verification_token');
        });
    }
}

Add email verification status & token to user table


<?php
error_reporting(error_reporting() & ~E_USER_DEPRECATED);

// Delegate 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;
}

chdir(dirname(__DIR__));
require 'vendor/autoload.php';

/** @var \Interop\Container\ContainerInterface $container */
$container = require 'config/container.php';

/** @var \Zend\Expressive\Application $app */
$app = $container->get(\Zend\Expressive\Application::class);
include 'config/pipeline.php';
include 'config/routes.php';
$app->run();

Add missing test asset (git ignored by default)


<?php

namespace Slakbal\Gotowebinar\Test\Unit;

use Slakbal\Gotowebinar\DirectLogin;
use Slakbal\Gotowebinar\Facade\GotoWebinar;
use Slakbal\Gotowebinar\Test\BaseTestCase;

class DirectLoginTest extends BaseTestCase
{
    /**
     * Test direct login for access token
     *
     * @return void
     */
    public function testDirectLogin()
    {
        $this->assertNotEmpty((new DirectLogin)->authenticate()->access_token);
    }
}

Test access token creation using oAuth2

Test access token creation using oAuth2


<?php
/*
 * This file is part of the Sonata project.
 *
 * (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Sonata\AdminBundle\Tests\Resources;

use Sonata\CoreBundle\Test\XliffValidatorTestCase;

class XliffTest extends XliffValidatorTestCase
{
    /**
     * @return array List all path to validate xliff
     */
    public function getXliffPaths()
    {
        return array(array(__DIR__.'/../../Resources/translations'));
    }
}

Add tests on xliff files

Add tests on xliff files


<?php

namespace App\Commands;

class AutoScanForNewFiles extends Command
{
    /** @var bool */
    protected $autoScan;

    /**
     * AutoScanForNewFIles constructor.
     *
     * @param bool $autoScan
     */
    public function __construct(bool $autoScan = false)
    {
        $this->autoScan = $autoScan;
    }

    /**
     * @return bool
     */
    public function isAutoScan(): bool
    {
        return $this->autoScan;
    }
}

Create a command object for processing files copied into the auto_scan directory.


<?php
/**
 * Adds body classes to the registered pages in the Restrict Content Pro settings
 *
 * @param $classes
 *
 * @return array
 */
function jp_add_body_classes( $classes ) {
	global $post, $rcp_options;

	if ( ! is_object( $post ) ) {
		return $classes;
	}

	if ( ! is_page() ) {
		return $classes;
	}

	$page_classes = array(
		'rcp-registration'   => isset( $rcp_options['registration_page'] ) ? $rcp_options['registration_page'] : 0,
		'rcp-success'        => isset( $rcp_options['redirect'] )          ? $rcp_options['redirect']          : 0,
		'rcp-account'        => isset( $rcp_options['account_page'] )      ? $rcp_options['account_page']      : 0,
		'rcp-edit-profile'   => isset( $rcp_options['edit_profile'] )      ? $rcp_options['edit_profile']      : 0,
		'rcp-update-billing' => isset( $rcp_options['update_card'] )       ? $rcp_options['update_card']       : 0,
	);

	$found_classes = array_keys( $page_classes, $post->ID );

	if ( ! empty( $found_classes ) ) {
		foreach ( $found_classes as $class ) {
			$classes[] = $class;
		}
	}

	return $classes;
}
add_filter( 'body_class', 'jp_add_body_classes', 10, 1 );

Add body class on RCP pages. props @cklosowski


<?php
namespace AppBundle\Tests\Entity;
use AppBundle\Entity\User;
use AppBundle\Entity\Item;
use Doctrine\Common\Collections\ArrayCollection;
/**
 * Class UserTest
 *
 * @author Prohorovych Andrew <prohorovychua@gmail.com>
 */
class UserTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @test
     */
    public function emptyUser()
    {
        $user = new User();
        $this->assertEquals('New User', $user->__toString());
        $this->assertNull($user->getId());
        $this->assertNull($user->getFullName());
        $this->assertNull($user->getFacebookAccessToken());
        $this->assertNull($user->getFacebookId());
        $this->assertEquals(0, $user->getItems()->count());
    }
    /**
     * Test setter and getter for Full Name
     *
     * @test
     */
    public function setGetFullName()
    {
        $fullName = 'Some Name';
        $user = (new User())->setFullName($fullName);
        $this->assertEquals($fullName, $user->getFullName());
    }
    /**
     * Test setter and getter for Item
     *
     * @test
     */
    public function setGetItem()
    {
        $items = new ArrayCollection();
        $items->add(new Item());
        $user = (new User())->setItems($items);
        $this->assertEquals(1, $user->getItems()->count());
        $this->assertEquals($items, $user->getItems());
    }
    /**
     * Test setter and getter for facebook id
     *
     * @test
     */
    public function setGetFacebookId()
    {
        $faceId = '123321';
        $user = (new User())->setFacebookId($faceId);
        $this->assertEquals($faceId, $user->getFacebookId());
    }
    /**
     * Test setter and getter for facebook access token
     *
     * @test
     */
    public function setGetFacebookAccessToken()
    {
        $faceAccessToken = '123321';
        $user = (new User())->setFacebookAccessToken($faceAccessToken);
        $this->assertEquals($faceAccessToken, $user->getFacebookAccessToken());
    }
    /**
     * Test add and remove for item
     *
     * @test
     */
    public function addRemoveItem()
    {
        $user = new User();
        $this->assertEquals(0, $user->getItems()->count());
        $user->addItem(new Item());
        $this->assertEquals(1, $user->getItems()->count());
        $item = $user->getItems()->first();
        $user->removeItem($item);
        $this->assertEquals(0, $user->getItems()->count());
    }
}

Add tests for user entity

Add tests for user entity


<?php
$I = new AcceptanceTester($scenario);
$I->wantTo('process tweets looking for beers');
$I->runShellCommand('php artisan nerds:cal test');
$I->seeInShellOutput('Not time to update');

Add test fo calendar update command

Add test fo calendar update command


<?php

use UWDOEM\Framework\FieldBearer\FieldBearer;

class MockFieldBearer extends FieldBearer {

    public $saved = false;

    public function __construct() {}

    public function save() {
        $this->saved = true;
    }
}

Add single file for mock classes.

Add single file for mock classes.


<?php
/*
 * Yes, thiswas copied straight across from SthsPlayer so all the bad decisions
 * were copied across and will have to be fixed here as well.
 */
use \SparkLib\DB;

class SthsGoalie {

  protected $attribs;

  public function __construct() {
    $this->attribs = [];
  }

  // return goalie by "number"
  // Note: for some reason, number isn't guaranteed to be unique but STHS treats
  // it that way. Do not want to deal with the possible edge cases of this, though.
  //
  // In the future this should return a goalie object instead
  public function getSthsGoalie($id) {
    $dbh = \SparkLib\DB::pdo();
    $sth = $dbh->prepare("SELECT * FROM sths_goalie WHERE number = :id");
    $sth->execute(['id' => $id]);

    $goalie = $sth->fetch(PDO::FETCH_ASSOC);
    return $goalie; // can be "false"
  }

  // This feels primitive, expensive, and stupid because it is... for now
  // Should just be called with $this->update() in the future and explode
  // the attributes instead and update everything at once
  public function updateSthsGoalie($id, $field, $val) {

    try {
      $dbh = \SparkLib\DB::pdo();
      $sth = $dbh->prepare("UPDATE sths_goalie SET $field = :val WHERE  number = :id");
      $sth->execute([':id'    => $id,
                     ':val'   => $val
                   ]);
    } catch (PDOException $e) {
        echo $e->getMessage();
    }
  }

}

Add rudimentary goalie model for parser

Add rudimentary goalie model for parser


<?php

namespace Rogue\Http\Transformers;

use Rogue\Models\Post;
use Rogue\Models\Signup;
use League\Fractal\TransformerAbstract;

class PhoenixGalleryTransformer extends TransformerAbstract
{
    /**
     * Transform resource data.
     *
     * @param \Rogue\Models\Photo $photo
     * @return array
     */
    public function transform(Post $post)
    {
    	$signup = $post->signup;
        $result = [
    		'id' => $post->postable_id,
    		'status' => $post->status,
    		'caption' => $post->content->caption,
    		'uri' => $post->content->file_url,
    		'media' => [
    			'uri' => $post->content->file_url,
    			'type' => 'image',
    		],
    		'created_at' => $post->created_at->toIso8601String(),
        	'reportback' => [
        		'id' => $signup->id,
        		'created_at' => $signup->created_at->toIso8601String(),
        		'updated_at' => $signup->updated_at->toIso8601String(),
        		'quantity' => $signup->quantity,
        		'why_participated' => $signup->why_participated,
        		'flagged' => 'false',
        	],
    	];

        return $result;
    }
}

Add transformer for the gallery endpoint


<?php

namespace Snaggle\Tests\Client\Credentials;

use PHPUnit_Framework_TestCase;

class TemporaryCredentialsTest extends PHPUnit_Framework_TestCase
{
    public function testCanAutoloadClass()
    {
        $this->assertTrue(class_exists('Snaggle\Oauth1\Client\Credentials\TemporaryCredentials'));
    }
}

Add test to prove autoloading fails

Enhancement: Add test to prove autoloading fails


<?php

namespace MCordingley\LaravelSapient\Test\Middleware;

use Illuminate\Http\Request;
use Illuminate\Http\Response;
use MCordingley\LaravelSapient\Middleware\SharedEncryptResponse;
use ParagonIE\Sapient\CryptographyKeys\SharedEncryptionKey;
use ParagonIE\Sapient\Simple;

final class SharedEncryptResponseTest extends TestCase
{
    public function testGoodKey()
    {
        $key = new SharedEncryptionKey(random_bytes(SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_KEYBYTES));
        $middleware = new SharedEncryptResponse($key);

        $request = static::createRequest();
        $unsealed = $request->getContent();

        $response = $middleware->handle($request, function (Request $request) {
            return new Response($request->getContent());
        });

        static::assertEquals($unsealed, Simple::decrypt($response->getContent(), $key));
    }
}

Test encrypting responses with a shared key.


<?php

CM_Db_Db::truncate("cm_model_languagekey");

$langList = new CM_Paging_Language_All();
foreach ($langList as $lang) {
    $lang->delete();
}

$serviceManager = CM_Service_Manager::getInstance();
$loadLang = new Denkmal_App_SetupScript_LoadLanguage($serviceManager);
$loadLang->load(new CM_OutputStream_Stream_Output());

$setupTranslations = new CM_App_SetupScript_Translations($serviceManager);
$setupTranslations->load(new CM_OutputStream_Stream_Output());

Add language deletion update script

Add language deletion update script


<form method="post" action="">
<input type="text" name="value">
<input type="submit">
</form>

<?php
include_once(__DIR__ . '/GetLowestOfferListingsForASIN.php');

$asin = array(
    array(
        "ASIN" => $_POST['value'],
        "Condition" => "UsedAcceptable"
    )
);
parseOffers($asin, $request);

Initialize testing script for pricer

Initialize testing script for pricer


<?php

/**
 * Process forking implementation
 * @author M2Mobi, Heinz Wiesinger
 */
class Fork
{

    /**
     * Constructor
     */
    public function __construct()
    {

    }

    /**
     * Destructor
     */
    public function __destruct()
    {

    }

    /**
     * Start multiple parallel child processes
     * @param Integer $number Amount of child processes to start
     * @param Mixed $call The call that should be executed by the child processes
     *      either "function" or "array('class','method')"
     * @param Array $data Prepared array of data to be processed by the child processes
     *      this array should be size() = $number
     * @return Mixed Either false if run out of CLI context or an array of child process statuses
     */
    public static function fork($number, $call, $data)
    {
        global $cli;
        if ($cli)
        {
            for($i = 0; $i < $number; ++$i)
            {
                $pids[$i] = pcntl_fork();

                if(!$pids[$i])
                {
                    // child process
                    call_user_func_array($call,$data[$i]);
                    exit();
                }
            }

            $result = SplFixedArray($number);

            for($i = 0; $i < $number; ++$i)
            {
                pcntl_waitpid($pids[$i], $status, WUNTRACED);
                $result[$i] = $status;
            }

            return $result;
        }
        else
        {
            return FALSE;
        }
    }

}

?>

application: Add process forking class, and avoid accidentally using it for the web (it's cli only functionality)


<?php
namespace Joindin\Model\API;

class JoindIn
{
    protected $baseApiUrl = 'http://api.joind.in';

    public function __construct()
    {
        $app = \Slim::getInstance();
        $config = $app->config('custom');

        if (isset($config['apiUrl'])) {
            $this->baseApiUrl = $config['apiUrl'];
        }
    }

    protected function apiGet($url)
    {
        $result = file_get_contents($url);

        if (false === $result) {
            throw new \Exception('Unable to connect to API');
        }

        return $result;
    }
}

<?php
namespace Joindin\Model\API;

class JoindIn
{
    protected $baseApiUrl = 'http://api.joind.in';
    protected $token;

    public function __construct()
    {
        $app = \Slim::getInstance();
        $config = $app->config('custom');

        if (isset($config['apiUrl'])) {
            $this->baseApiUrl = $config['apiUrl'];
        }

        $this->token = isset($_SESSION['access_token']) ? $_SESSION['access_token'] : null;
    }

    protected function apiGet($url, $params = array())
    {
        $paramsString = count($params) ? '?' . http_build_query($params, '', '&') : '';

        $contextOpts = array('http' => array(
            'header'  => "Content-type: \r\n"
                       . "Accept: application/json",
            'timeout' => 10,
            )
        );

        $streamContext = stream_context_create($contextOpts);
        $result = file_get_contents($url.$paramsString, 0, $streamContext);

        if (false === $result) {
            throw new \Exception('Unable to connect to API');
        }

        return $result;
    }

    protected function apiPost($url, $params = array())
    {
        $contextOpts = array('http' => array(
            'method'  => 'POST',
            'header'  => "Content-type: application/json\r\n"
                       . "Accept: application/json",
            'content' => json_encode($params),
            'timeout' => 10,
            )
        );

        if ($this->token) {
            $contextOpts['http']['header'] .= "\r\nAuthorization: OAuth {$this->token}";
        }

        $streamContext = stream_context_create($contextOpts);
        $result = file_get_contents($url, 0, $streamContext);
        if (false === $result) {
            throw new \Exception('Unable to connect to API');
        }

        return $result;
    }
}

Add apiPost() and fix apiGet() to send the correct headers.


#!/usr/bin/env php
<?php
/*
 * StatusNet - a distributed open-source microblogging tool
 * Copyright (C) 2008, 2009, StatusNet, Inc.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));

$shortoptions = 'y';
$longoptions = array('yes');

$helptext = <<<END_OF_HELP
delete_orphan_files.php [options]
Deletes all files and their File entries where there is no link to a
Notice entry. Good for cleaning up after user deletion or so where the
attached files weren't removed as well.

  -y --yes      do not wait for confirmation

Will print '.' for each deleted File entry and 'x' if it also had a locally stored file.

END_OF_HELP;

require_once INSTALLDIR.'/scripts/commandline.inc';

if (!have_option('y', 'yes')) {
    print "About to delete local files that are not related to a Notice. Are you sure? [y/N] ";
    $response = fgets(STDIN);
    if (strtolower(trim($response)) != 'y') {
        print "Aborting.\n";
        exit(0);
    }
}

print "Finding File entries...";
$file = new File();
$sql = 'SELECT * FROM file WHERE NOT EXISTS (SELECT id FROM file_to_post WHERE file.id=file_id);';
if ($file->query($sql) !== false) {
    print " Deleting {$file->N} entries: ";
    while ($file->fetch()) {
        try {
            $file->getPath();
            $file->delete();
            print 'x';
        } catch (Exception $e) {
            // either FileNotFound exception or ClientException
            $file->delete();
            print '.';
        }
    }
}
print "\nDONE.\n";

Delete orphan files maintenance script

Delete orphan files maintenance script

When deleting a profile it'll delete its notices and the coupling to
file entries, but not the file entries themselves (and thus not the
files). So if one to delete a person uploading offending images, then
the images are left behind and can be hotlinked. This will remove it.


<?php

/**
 * Plugin name: Self Publisher
 * Plugin URI: not-yet-here
 * Description: 'testets'
 * Version: 0.1
 * Author: The A-Team
 * License: TBA
 */

// @TODO mechanism to store to db
// @TODO mechanism to get all from db
// @TODO parse the data into arrays and make them global
// @TODO ajax storing

add_action('admin_menu', sfp_menu);
function sfp_menu (){
    add_menu_page('Self Publish Settings','Self Publish Settings','administrator',__FILE__,'sfp_settings_page');
}
function sfp_settings_page(){
    // @TODO render list of models here in table
    // @TODO create javascript namespaced var with types, maybe to json or
    // something
    // @TODO add nonces to js
    echo '<script type=text/javascript>window.sfpSettings = {}</script>';
}

register_activation_hook(__FILE__,'sfp_install');
function sfp_install(){
    global $wpdb;
    global $sfp_db_version;

    $table_name = $wpdb->prefix . "selfpublisher";
    if($wpdb->get_var("show tables like '$table_name'") != $table_name){
        $sql = "CREATE TABLE $table_name (
            id smallint(3) NOT NULL AUTO_INCREMENT,
            name tinytext NOT NULL,
            UNIQUE KEY id (id)
        );";
        require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
        dbDelta($sql);
    } else {
        // @TODO create custom post types
    }

    add_option("sfp_db_version", $sfp_db_version);
}

// @TODO test ajax calls
// jquery deferred example
// a = jQuery.post('admin-ajax.php',{'action':'addmodel'})}
add_action('wp_ajax_addmodel', 'sfp_addmodel');
function sfp_addmodel(){
    $nonce = $_POST['nonce'];
    if (wp_verify_nonce($nonce,'sfp_add_category')) {
        print_r($_POST);
        echo 'merge add';
        exit();
    }
}
add_action('wp_ajax_removemodel', 'sfp_removemodel');
function sfp_removemodel(){
    $nonce = $_POST['nonce'];
    if (wp_verify_nonce($nonce,'sfp_remove_category')) {
        print_r($_POST);
        echo 'merge delete';
        exit();
    }
}
?>

Add first steps for module.

Add first steps for module.


<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AddIndexes extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        // Add additional indexes to some tables. These indexes may or may not
        // be redundant
        Schema::table('recommendations', function (Blueprint $table) {
            $table->index('survey_id');
            $table->index('resolved');
        });
        Schema::table('machines', function (Blueprint $table) {
            $table->index('modality_id');
            $table->index('manufacturer_id');
            $table->index('location_id');
        });
        Schema::table('opnotes', function (Blueprint $table) {
            $table->index('machine_id');
        });

        Schema::table('testdates', function (Blueprint $table) {
            $table->index('machine_id');
            $table->index('tester1_id');
            $table->index('tester2_id');
            $table->index('type_id');
        });
        Schema::table('tubes', function (Blueprint $table) {
            $table->index('machine_id');
            $table->index('housing_manuf_id');
            $table->index('insert_manuf_id');
        })
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
    }
}

Add additional indexes to some tables.

Add additional indexes to some tables.

These indexes may or may not be redundant


<?php

/**
 * @author Andreas Kummer, w3concepts AG
 * @copyright Copyright © 2011, w3concepts AG
 */

class Aitsu_Form_Validation_Expression_Depending implements Aitsu_Form_Validation_Expression_Interface {

	protected $args;

	protected function __construct($args) {

		$this->args = $args;
	}

	public static function init($args) {

		return new self($args);
	}

	public function isValid(& $value) {

		if (!isset($_POST[$this->args['on']]) || empty($_POST[$this->args['on']])) {
			return true;
		}

		if (!empty($value)) {
			return true;
		}

		return false;
	}
}

Add new validation (not finished).

Add new validation (not finished).


<?php
require './includes/global.inc';

class sRequestTest extends PHPUnit_Framework_TestCase {
  public function testCheckCSRFToken() {
    $csrf = fRequest::generateCSRFToken('/');
    $this->assertTrue(sRequest::checkCSRFToken($csrf, '/'));
    $this->assertFalse(sRequest::checkCSRFToken('sss', '/'));
  }

  public function testSavePostValues() {
    $_POST = array(
      'key' => 'value',
      'key1' => 'value2',
    );

    sRequest::savePostValues('aaa');
    $values = sRequest::retrievePostValues('aaa');
    $this->assertInternalType('array', $values);
    $this->assertEquals($_POST, $values);
  }

  public function testSetPostValues() {
    $original = $_POST = array(
      'key' => 'value',
      'key1' => 'value2',
    );
    sRequest::savePostValues('bbb');
    $_POST = array();
    $_SERVER['REQUEST_METHOD'] = 'POST';
    sRequest::setPostValues('bbb');
    $this->assertEquals($original, $_POST);
  }

  public function testDeletePostValues() {
    $_POST = array(
      'key' => 'value',
      'key1' => 'value2',
    );
    sRequest::savePostValues('bbb');
    sRequest::deletePostValues('bbb');
    $this->assertNull(fSession::get(sRequest::LAST_POST_SESSION_KEY_PREFIX.'::bbb'));
  }

  public function testRetrieveNotArrayFromSession() {
    fSession::set(sRequest::LAST_POST_SESSION_KEY_PREFIX.'::bbb', 'a');
    $values = sRequest::retrievePostValues('bbb');
    $this->assertInternalType('array', $values);
    $this->assertEquals(array(), $values);
  }

  public function tearDown() {
    $_SERVER['REQUEST_METHOD'] = 'GET';
    fSession::reset();
  }
}

Add unit test for sRequest class

Add unit test for sRequest class