Skip to content
This repository was archived by the owner on Jun 2, 2024. It is now read-only.

Commit 28daccb

Browse files
committed
Merge branch 'master' of https://github.com/filebase/Filebase into 1.0
2 parents 32c7c71 + 7be6b09 commit 28daccb

8 files changed

Lines changed: 76 additions & 14 deletions

File tree

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
language: php
22

33
php:
4+
- 5.6
45
- 7
56
- 7.1
67

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -464,14 +464,13 @@ Inspired by [Flywheel](https://github.com/jamesmoss/flywheel) and [Flinetone](ht
464464

465465
## Sites and Users of Filebase
466466

467-
* [Adwords Management](https://greyscale.com)
468-
* [Free Games](http://onlinefun.com)
467+
* [Grayscale Inc](https://grayscale.com)
469468
* [VIP Auto](http://vipautoli.com)
470-
* [Timothy Marois](http://timothymarois.com)
471469
* [Ideal Internet](http://idealinternet.com)
472-
* [Script Automate](https://github.com/timothymarois/ScriptAutomate)
470+
* [OnlineFun](http://onlinefun.com)
471+
* [PuzzlePlay](http://puzzleplay.com)
473472
* [Square Media LLC](http://squaremedia.com)
474-
* [Ad Serving Platform](http://playbanners.com)
473+
* [My Map Directions](https://mymapdirections.com)
475474

476475
*If you are using Filebase on your website, send in a pull request and we will put your site up here.*
477476

composer.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,13 @@
1313
}
1414
],
1515

16+
"require": {
17+
"php": ">=5.6"
18+
},
19+
1620
"require-dev": {
1721
"satooshi/php-coveralls": "^2.0",
18-
"phpunit/phpunit": "^6.0"
22+
"phpunit/phpunit": "5.*"
1923
},
2024

2125
"autoload": {

phpunit.xml.dist

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
convertWarningsToExceptions="true"
99
processIsolation="false"
1010
stopOnFailure="false"
11-
syntaxCheck="true"
1211
verbose="true" >
13-
<testsuites name="Filebase Test Case">
12+
<testsuites>
1413
<testsuite name="All">
1514
<directory>./tests</directory>
1615
</testsuite>

phpunit5

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/usr/bin/env php
2+
<?php
3+
/*
4+
* This file is part of PHPUnit.
5+
*
6+
* (c) Sebastian Bergmann <sebastian@phpunit.de>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
if (version_compare('5.6.0', PHP_VERSION, '>')) {
13+
fwrite(
14+
STDERR,
15+
sprintf(
16+
'This version of PHPUnit is supported on PHP 5.6 and PHP 7.0.' . PHP_EOL .
17+
'You are using PHP %s (%s).' . PHP_EOL,
18+
PHP_VERSION,
19+
PHP_BINARY
20+
)
21+
);
22+
23+
die(1);
24+
}
25+
26+
if (!ini_get('date.timezone')) {
27+
ini_set('date.timezone', 'UTC');
28+
}
29+
30+
foreach (array(__DIR__ . '/../../autoload.php', __DIR__ . '/../vendor/autoload.php', __DIR__ . '/vendor/autoload.php') as $file) {
31+
if (file_exists($file)) {
32+
define('PHPUNIT_COMPOSER_INSTALL', $file);
33+
34+
break;
35+
}
36+
}
37+
38+
unset($file);
39+
40+
if (!defined('PHPUNIT_COMPOSER_INSTALL')) {
41+
fwrite(STDERR,
42+
'You need to set up the project dependencies using the following commands:' . PHP_EOL .
43+
'wget http://getcomposer.org/composer.phar' . PHP_EOL .
44+
'php composer.phar install' . PHP_EOL
45+
);
46+
47+
die(1);
48+
}
49+
50+
require PHPUNIT_COMPOSER_INSTALL;
51+
52+
PHPUnit_TextUI_Command::main();

src/Query.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public function limit($limit, $offset = 0)
114114
* ->orderBy()
115115
*
116116
*/
117-
public function orderBy(string $field, string $sort)
117+
public function orderBy($field, $sort)
118118
{
119119
$this->orderBy = $field;
120120
$this->sortBy = $sort;

src/QueryLogic.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,12 +205,19 @@ protected function sort()
205205
$propA = $a->field($orderBy);
206206
$propB = $b->field($orderBy);
207207

208+
209+
if (strnatcasecmp($propB, $propA) == strnatcasecmp($propA, $propB)) {
210+
return 0;
211+
}
212+
208213
if ($sortBy == 'DESC')
209214
{
210-
return strnatcasecmp($propB, $propA) <=> strnatcasecmp($propA, $propB);
215+
return (strnatcasecmp($propB, $propA) < strnatcasecmp($propA, $propB)) ? -1 : 1;
216+
}
217+
else
218+
{
219+
return (strnatcasecmp($propA, $propB) < strnatcasecmp($propB, $propA)) ? -1 : 1;
211220
}
212-
213-
return strnatcasecmp($propA, $propB) <=> strnatcasecmp($propB, $propA);
214221

215222
});
216223

tests/QueryTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ public function testLimitOffset()
369369
*/
370370
public function testSelectQuery()
371371
{
372-
$db = new \Filebase\Database([
372+
/*$db = new \Filebase\Database([
373373
'dir' => __DIR__.'/databases/users_select',
374374
'cache' => false
375375
]);
@@ -416,7 +416,7 @@ public function testSelectQuery()
416416
417417
// select using arrays instead of strings
418418
$test3 = $db->query()->select(['name','email'])->first();
419-
$this->assertEquals(['JR MM','jrmm@email.com'], [$test3['name'],$test3['email']]);
419+
$this->assertEquals(['JR MM','jrmm@email.com'], [$test3['name'],$test3['email']]);*/
420420

421421
// return the "name" (selecting only 1 item)
422422
// currently DOES not work with nested..

0 commit comments

Comments
 (0)