diff options
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend')
3 files changed, 28 insertions, 60 deletions
diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/AbstractTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/AbstractTest.php index f39e9a036..bbde69097 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/AbstractTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/AbstractTest.php @@ -31,15 +31,15 @@ abstract class AbstractTest extends \PHPUnit_Framework_TestCase { $lock->timeout = 60; $lock->created = time(); $lock->token = 'MY-UNIQUE-TOKEN'; - $lock->uri ='someuri'; + $lock->uri = 'someuri'; $this->assertTrue($backend->lock('someuri', $lock)); $locks = $backend->getLocks('someuri', false); - $this->assertEquals(1,count($locks)); - $this->assertEquals('Sinterklaas',$locks[0]->owner); - $this->assertEquals('someuri',$locks[0]->uri); + $this->assertEquals(1, count($locks)); + $this->assertEquals('Sinterklaas', $locks[0]->owner); + $this->assertEquals('someuri', $locks[0]->uri); } @@ -61,9 +61,9 @@ abstract class AbstractTest extends \PHPUnit_Framework_TestCase { $locks = $backend->getLocks('someuri/child', false); - $this->assertEquals(1,count($locks)); - $this->assertEquals('Sinterklaas',$locks[0]->owner); - $this->assertEquals('someuri',$locks[0]->uri); + $this->assertEquals(1, count($locks)); + $this->assertEquals('Sinterklaas', $locks[0]->owner); + $this->assertEquals('someuri', $locks[0]->uri); } @@ -86,7 +86,7 @@ abstract class AbstractTest extends \PHPUnit_Framework_TestCase { $locks = $backend->getLocks('someuri/child', false); - $this->assertEquals(0,count($locks)); + $this->assertEquals(0, count($locks)); } @@ -104,13 +104,13 @@ abstract class AbstractTest extends \PHPUnit_Framework_TestCase { $this->assertTrue($backend->lock('someuri/child', $lock)); $locks = $backend->getLocks('someuri/child', false); - $this->assertEquals(1,count($locks)); + $this->assertEquals(1, count($locks)); $locks = $backend->getLocks('someuri', false); - $this->assertEquals(0,count($locks)); + $this->assertEquals(0, count($locks)); $locks = $backend->getLocks('someuri', true); - $this->assertEquals(1,count($locks)); + $this->assertEquals(1, count($locks)); } @@ -135,10 +135,10 @@ abstract class AbstractTest extends \PHPUnit_Framework_TestCase { $locks = $backend->getLocks('someuri', false); - $this->assertEquals(1,count($locks)); + $this->assertEquals(1, count($locks)); - $this->assertEquals('Santa Clause',$locks[0]->owner); - $this->assertEquals('someuri',$locks[0]->uri); + $this->assertEquals('Santa Clause', $locks[0]->owner); + $this->assertEquals('someuri', $locks[0]->uri); } @@ -158,12 +158,12 @@ abstract class AbstractTest extends \PHPUnit_Framework_TestCase { $this->assertTrue($backend->lock('someuri', $lock)); $locks = $backend->getLocks('someuri', false); - $this->assertEquals(1,count($locks)); + $this->assertEquals(1, count($locks)); - $this->assertTrue($backend->unlock('someuri',$lock)); + $this->assertTrue($backend->unlock('someuri', $lock)); $locks = $backend->getLocks('someuri', false); - $this->assertEquals(0,count($locks)); + $this->assertEquals(0, count($locks)); } @@ -183,13 +183,13 @@ abstract class AbstractTest extends \PHPUnit_Framework_TestCase { $this->assertTrue($backend->lock('someuri', $lock)); $locks = $backend->getLocks('someuri', false); - $this->assertEquals(1,count($locks)); + $this->assertEquals(1, count($locks)); $lock->token = 'SOME-OTHER-TOKEN'; - $this->assertFalse($backend->unlock('someuri',$lock)); + $this->assertFalse($backend->unlock('someuri', $lock)); $locks = $backend->getLocks('someuri', false); - $this->assertEquals(1,count($locks)); + $this->assertEquals(1, count($locks)); } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/PDOMySQLTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/PDOMySQLTest.php index b6f06224c..0ba02fc8b 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/PDOMySQLTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/PDOMySQLTest.php @@ -2,31 +2,8 @@ namespace Sabre\DAV\Locks\Backend; -require_once 'Sabre/TestUtil.php'; +class PDOMySQLTest extends PDOTest { -class PDOMySQLTest extends AbstractTest { - - function getBackend() { - - if (!SABRE_HASMYSQL) $this->markTestSkipped('MySQL driver is not available, or it was not properly configured'); - $pdo = \Sabre\TestUtil::getMySQLDB(); - if (!$pdo) $this->markTestSkipped('Could not connect to MySQL database'); - $pdo->query('DROP TABLE IF EXISTS locks;'); - $pdo->query(" -CREATE TABLE locks ( - id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, - owner VARCHAR(100), - timeout INTEGER UNSIGNED, - created INTEGER, - token VARCHAR(100), - scope TINYINT, - depth TINYINT, - uri text -);"); - - $backend = new PDO($pdo); - return $backend; - - } + public $driver = 'mysql'; } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/PDOTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/PDOTest.php index d6336c7b2..a27eae93c 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/PDOTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/PDOTest.php @@ -2,27 +2,18 @@ namespace Sabre\DAV\Locks\Backend; -require_once 'Sabre/TestUtil.php'; -require_once 'Sabre/DAV/Locks/Backend/AbstractTest.php'; +abstract class PDOTest extends AbstractTest { -class PDOTest extends AbstractTest { + use \Sabre\DAV\DbTestHelperTrait; function getBackend() { - if (!SABRE_HASSQLITE) $this->markTestSkipped('SQLite driver is not available'); - \Sabre\TestUtil::clearTempDir(); - mkdir(SABRE_TEMPDIR . '/pdolocks'); - $pdo = new \PDO('sqlite:' . SABRE_TEMPDIR . '/pdolocks/db.sqlite'); - $pdo->setAttribute(\PDO::ATTR_ERRMODE,\PDO::ERRMODE_EXCEPTION); - $pdo->query('CREATE TABLE locks ( id integer primary key asc, owner text, timeout text, created integer, token text, scope integer, depth integer, uri text)'); - $backend = new PDO($pdo); - return $backend; + $this->dropTables('locks'); + $this->createSchema('locks'); - } - - function tearDown() { + $pdo = $this->getPDO(); - \Sabre\TestUtil::clearTempDir(); + return new PDO($pdo); } |