Browse Source

Merge branch 'master' into 3.next

Mark Story 9 years ago
parent
commit
24b40c67ba

+ 2 - 2
.travis.yml

@@ -9,7 +9,7 @@ dist: trusty
 
 env:
   matrix:
-    - DB=mysql db_dsn='mysql://root@0.0.0.0/cakephp_test'
+    - DB=mysql db_dsn='mysql://root@127.0.0.1/cakephp_test'
     - DB=pgsql db_dsn='postgres://postgres@127.0.0.1/cakephp_test'
     - DB=sqlite db_dsn='sqlite:///:memory:'
   global:
@@ -19,6 +19,7 @@ services:
   - memcached
   - redis-server
   - postgresql
+  - mysql
 
 addons:
   postgresql: "9.4"
@@ -49,7 +50,6 @@ before_install:
 
   - if [ -n "$GH_TOKEN" ]; then composer config github-oauth.github.com ${GH_TOKEN}; fi;
 
-  - if [ $DB = 'mysql' ]; then sudo apt-get -y install mysql-server; fi
   - if [ $DB = 'mysql' ]; then mysql -u root -e 'CREATE DATABASE cakephp_test;'; fi
   - if [ $DB = 'mysql' ]; then mysql -u root -e 'CREATE DATABASE cakephp_test2;'; fi
   - if [ $DB = 'mysql' ]; then mysql -u root -e 'CREATE DATABASE cakephp_test3;'; fi

+ 1 - 1
composer.json

@@ -24,7 +24,7 @@
         "ext-mbstring": "*",
         "cakephp/chronos": "~1.0",
         "aura/intl": "1.1.*",
-        "psr/log": "1.0",
+        "psr/log": "^1.0",
         "zendframework/zend-diactoros": "~1.0"
     },
     "suggest": {

+ 1 - 1
src/Error/ExceptionRenderer.php

@@ -352,7 +352,7 @@ class ExceptionRenderer
         $builder->helpers($helpers, false)
             ->layoutPath('')
             ->templatePath('Error');
-        $view = $this->controller->createView();
+        $view = $this->controller->createView('View');
 
         $this->controller->response->body($view->render($template, 'error'));
         $this->controller->response->type('html');

+ 1 - 1
src/Log/composer.json

@@ -15,6 +15,6 @@
     },
     "require": {
         "cakephp/core": "~3.0",
-        "psr/log": "1.0"
+        "psr/log": "^1.0"
     }
 }

+ 3 - 1
src/ORM/Behavior/TreeBehavior.php

@@ -483,10 +483,12 @@ class TreeBehavior extends Behavior
      */
     public function findTreeList(Query $query, array $options)
     {
+        $left = $this->_table->aliasField($this->config('left'));
+
         $results = $this->_scope($query)
             ->find('threaded', [
                 'parentField' => $this->config('parent'),
-                'order' => [$this->config('left') => 'ASC'],
+                'order' => [$left => 'ASC'],
             ]);
 
         return $this->formatTreeList($results, $options);

+ 0 - 27
tests/TestCase/Filesystem/FolderTest.php

@@ -1372,33 +1372,6 @@ class FolderTest extends TestCase
     }
 
     /**
-     * testSortByTime2 method
-     *
-     * Verify that the order using modified time is correct.
-     *
-     * @return void
-     */
-    public function testSortByTime2()
-    {
-        $Folder = new Folder(TMP . 'tests', true);
-
-        $fileA = new File($Folder->pwd() . DS . 'a.txt');
-        $fileA->create();
-
-        $fileC = new File($Folder->pwd() . DS . 'c.txt');
-        $fileC->create();
-
-        sleep(1);
-
-        $fileB = new File($Folder->pwd() . DS . 'b.txt');
-        $fileB->create();
-
-        $results = $Folder->find('.*', Folder::SORT_TIME);
-
-        $this->assertSame(['a.txt', 'c.txt', 'b.txt'], $results);
-    }
-
-    /**
      * Verify that the order using name is correct.
      */
     public function testSortByName()

+ 9 - 1
tests/TestCase/ORM/Behavior/TreeBehaviorTest.php

@@ -256,7 +256,15 @@ class TreeBehaviorTest extends TestCase
     {
         $table = TableRegistry::get('MenuLinkTrees');
         $table->addBehavior('Tree', ['scope' => ['menu' => 'main-menu']]);
-        $result = $table->find('treeList')->toArray();
+        $query = $table->find('treeList');
+
+        $result = null;
+        $query->clause('order')->iterateParts(function ($dir, $field) use (&$result) {
+            $result = $field;
+        });
+        $this->assertEquals('MenuLinkTrees.lft', $result);
+
+        $result = $query->toArray();
         $expected = [
             1 => 'Link 1',
             2 => '_Link 2',