Browse Source

silent sqlite chmod for tests

Erwane Breton 8 years ago
parent
commit
50029e7606
2 changed files with 5 additions and 2 deletions
  1. 3 1
      src/Database/Driver/Sqlite.php
  2. 2 1
      tests/TestCase/Database/Driver/SqliteTest.php

+ 3 - 1
src/Database/Driver/Sqlite.php

@@ -68,7 +68,9 @@ class Sqlite extends Driver
         $this->_connect($dsn, $config);
 
         if (!$databaseExists && $config['database'] != ':memory:') {
-            chmod($config['database'], $config['mask']);
+            //@codingStandardsIgnoreStart
+            @chmod($config['database'], $config['mask']);
+            //@codingStandardsIgnoreEnd
         }
 
         if (!empty($config['init'])) {

+ 2 - 1
tests/TestCase/Database/Driver/SqliteTest.php

@@ -69,7 +69,8 @@ class SqliteTest extends TestCase
             'database' => 'bar.db',
             'flags' => [1 => true, 2 => false],
             'encoding' => 'a-language',
-            'init' => ['Execute this', 'this too']
+            'init' => ['Execute this', 'this too'],
+            'mask' => 0666
         ];
         $driver = $this->getMockBuilder('Cake\Database\driver\Sqlite')
             ->setMethods(['_connect', 'connection'])