[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pecl-cvs
Subject:    [PECL-CVS] =?utf-8?q?svn:_/pecl/dbase/branches/dbase-5.1/tests/_dbase=5Fadd=5Frecord=5Fvariation3.ph
From:       Christoph_Michael_Becker <cmb () php ! net>
Date:       2016-10-28 20:27:06
Message-ID: svn-cmb-1477686426-340777-1355133060 () svn ! php ! net
[Download RAW message or body]

cmb                                      Fri, 28 Oct 2016 20:27:06 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=340777

Log:
Test that the date of last update is properly updated

Changed paths:
    A   pecl/dbase/branches/dbase-5.1/tests/dbase_add_record_variation3.phpt
    A   pecl/dbase/branches/dbase-5.1/tests/dbase_create_variation1.phpt
    A   pecl/dbase/branches/dbase-5.1/tests/dbase_delete_record_variation1.phpt
    A   pecl/dbase/branches/dbase-5.1/tests/dbase_pack_variation1.phpt
    A   pecl/dbase/branches/dbase-5.1/tests/dbase_replace_record_variation3.phpt

Added: pecl/dbase/branches/dbase-5.1/tests/dbase_add_record_variation3.phpt
===================================================================
--- pecl/dbase/branches/dbase-5.1/tests/dbase_add_record_variation3.phpt	             \
                (rev 0)
+++ pecl/dbase/branches/dbase-5.1/tests/dbase_add_record_variation3.phpt	2016-10-28 \
20:27:06 UTC (rev 340777) @@ -0,0 +1,33 @@
+--TEST--
+dbase_add_record(): date of last update is properly updated
+--SKIPIF--
+<?php
+if (!extension_loaded('dbase')) die('skip dbase extension not available');
+?>
+--INI--
+date.timezone=UTC
+--FILE--
+<?php
+$filename = __DIR__ . DIRECTORY_SEPARATOR . 'dbase_add_record_variation3.dbf';
+copy(__DIR__ . DIRECTORY_SEPARATOR . 'example.dbf', $filename);
+$db = dbase_open($filename, 2);
+dbase_add_record($db, array(4711, 'foo', '20161028', 'F', 1.23));
+dbase_close($db);
+$date = getdate();
+$result = unpack('C4byte', file_get_contents($filename));
+var_dump(
+    $result['byte2'] + 1900 == $date['year'],
+    $result['byte3'] == $date['mon'],
+    $result['byte4'] == $date['mday']
+);
+?>
+===DONE===
+--EXPECT--
+bool(true)
+bool(true)
+bool(true)
+===DONE===
+--CLEAN--
+<?php
+unlink(__DIR__ . DIRECTORY_SEPARATOR . 'dbase_add_record_variation3.dbf');
+?>

Added: pecl/dbase/branches/dbase-5.1/tests/dbase_create_variation1.phpt
===================================================================
--- pecl/dbase/branches/dbase-5.1/tests/dbase_create_variation1.phpt	                 \
                (rev 0)
+++ pecl/dbase/branches/dbase-5.1/tests/dbase_create_variation1.phpt	2016-10-28 \
20:27:06 UTC (rev 340777) @@ -0,0 +1,31 @@
+--TEST--
+dbase_create(): date of last update is properly updated
+--SKIPIF--
+<?php
+if (!extension_loaded('dbase')) die('skip dbase extension not available');
+?>
+--INI--
+date.timezone=UTC
+--FILE--
+<?php
+$filename = __DIR__ . DIRECTORY_SEPARATOR . 'dbase_create_variation1.dbf';
+$db = dbase_create($filename, array(array('foo', 'C', 1)));
+dbase_close($db);
+$date = getdate();
+$result = unpack('C4byte', file_get_contents($filename));
+var_dump(
+    $result['byte2'] + 1900 == $date['year'],
+    $result['byte3'] == $date['mon'],
+    $result['byte4'] == $date['mday']
+);
+?>
+===DONE===
+--EXPECT--
+bool(true)
+bool(true)
+bool(true)
+===DONE===
+--CLEAN--
+<?php
+unlink(__DIR__ . DIRECTORY_SEPARATOR . 'dbase_create_variation1.dbf');
+?>

Added: pecl/dbase/branches/dbase-5.1/tests/dbase_delete_record_variation1.phpt
===================================================================
--- pecl/dbase/branches/dbase-5.1/tests/dbase_delete_record_variation1.phpt	          \
                (rev 0)
+++ pecl/dbase/branches/dbase-5.1/tests/dbase_delete_record_variation1.phpt	2016-10-28 \
20:27:06 UTC (rev 340777) @@ -0,0 +1,33 @@
+--TEST--
+dbase_delete_record(): date of last update is properly updated
+--SKIPIF--
+<?php
+if (!extension_loaded('dbase')) die('skip dbase extension not available');
+?>
+--INI--
+date.timezone=UTC
+--FILE--
+<?php
+$filename = __DIR__ . DIRECTORY_SEPARATOR . 'dbase_delete_record_variation1.dbf';
+copy(__DIR__ . DIRECTORY_SEPARATOR . 'example.dbf', $filename);
+$db = dbase_open($filename, 2);
+dbase_delete_record($db, 1);
+dbase_close($db);
+$date = getdate();
+$result = unpack('C4byte', file_get_contents($filename));
+var_dump(
+    $result['byte2'] + 1900 == $date['year'],
+    $result['byte3'] == $date['mon'],
+    $result['byte4'] == $date['mday']
+);
+?>
+===DONE===
+--EXPECT--
+bool(true)
+bool(true)
+bool(true)
+===DONE===
+--CLEAN--
+<?php
+unlink(__DIR__ . DIRECTORY_SEPARATOR . 'dbase_delete_record_variation1.dbf');
+?>

Added: pecl/dbase/branches/dbase-5.1/tests/dbase_pack_variation1.phpt
===================================================================
--- pecl/dbase/branches/dbase-5.1/tests/dbase_pack_variation1.phpt	                   \
                (rev 0)
+++ pecl/dbase/branches/dbase-5.1/tests/dbase_pack_variation1.phpt	2016-10-28 \
20:27:06 UTC (rev 340777) @@ -0,0 +1,33 @@
+--TEST--
+dbase_pack(): date of last update is properly updated
+--SKIPIF--
+<?php
+if (!extension_loaded('dbase')) die('skip dbase extension not available');
+?>
+--INI--
+date.timezone=UTC
+--FILE--
+<?php
+$filename = __DIR__ . DIRECTORY_SEPARATOR . 'dbase_pack_variation1.dbf';
+copy(__DIR__ . DIRECTORY_SEPARATOR . 'example.dbf', $filename);
+$db = dbase_open($filename, 2);
+dbase_pack($db);
+dbase_close($db);
+$date = getdate();
+$result = unpack('C4byte', file_get_contents($filename));
+var_dump(
+    $result['byte2'] + 1900 == $date['year'],
+    $result['byte3'] == $date['mon'],
+    $result['byte4'] == $date['mday']
+);
+?>
+===DONE===
+--EXPECT--
+bool(true)
+bool(true)
+bool(true)
+===DONE===
+--CLEAN--
+<?php
+unlink(__DIR__ . DIRECTORY_SEPARATOR . 'dbase_pack_variation1.dbf');
+?>

Added: pecl/dbase/branches/dbase-5.1/tests/dbase_replace_record_variation3.phpt
===================================================================
--- pecl/dbase/branches/dbase-5.1/tests/dbase_replace_record_variation3.phpt	         \
                (rev 0)
+++ pecl/dbase/branches/dbase-5.1/tests/dbase_replace_record_variation3.phpt	2016-10-28 \
20:27:06 UTC (rev 340777) @@ -0,0 +1,33 @@
+--TEST--
+dbase_replace_record(): date of last update is properly updated
+--SKIPIF--
+<?php
+if (!extension_loaded('dbase')) die('skip dbase extension not available');
+?>
+--INI--
+date.timezone=UTC
+--FILE--
+<?php
+$filename = __DIR__ . DIRECTORY_SEPARATOR . 'dbase_replace_record_variation3.dbf';
+copy(__DIR__ . DIRECTORY_SEPARATOR . 'example.dbf', $filename);
+$db = dbase_open($filename, 2);
+dbase_replace_record($db, array(4711, 'foo', '20161028', 'F', 1.23), 1);
+dbase_close($db);
+$date = getdate();
+$result = unpack('C4byte', file_get_contents($filename));
+var_dump(
+    $result['byte2'] + 1900 == $date['year'],
+    $result['byte3'] == $date['mon'],
+    $result['byte4'] == $date['mday']
+);
+?>
+===DONE===
+--EXPECT--
+bool(true)
+bool(true)
+bool(true)
+===DONE===
+--CLEAN--
+<?php
+unlink(__DIR__ . DIRECTORY_SEPARATOR . 'dbase_replace_record_variation3.dbf');
+?>



-- 
PECL CVS Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic