Permalink
Browse files

Add a few simple unit tests

  • Loading branch information...
1 parent dd37a90 commit 1b566a60e7fad761c615ee8d29521ddfd45a7b15 @mrook mrook committed Apr 16, 2013
Showing with 559 additions and 0 deletions.
  1. +36 −0 tests/diff.phpt
  2. +70 −0 tests/list.phpt
  3. +36 −0 tests/log.phpt
  4. +414 −0 tests/phpt_test.php.inc
  5. +3 −0 tests/setup.php.inc
View
@@ -0,0 +1,36 @@
+--TEST--
+test diff
+--SKIPIF--
+--FILE--
+<?php
+require_once dirname(__FILE__) . '/setup.php.inc';
+
+$changeset = '325013';
+$url = 'http://svn.php.net/repository/pear';
+
+$options = array('fetchmode' => VERSIONCONTROL_SVN_FETCHMODE_ASSOC);
+$switches = array('summarize' => true, 'c' => $changeset);
+
+$svn = VersionControl_SVN::factory(array('diff'), $options);
+
+$result = $svn->diff->run(array($url), $switches);
+
+var_export($result);
+echo "\ntests done\n";
+?>
+--CLEAN--
+--EXPECT--
+array (
+ 'path' =>
+ array (
+ 0 =>
+ array (
+ 'text' => 'http://svn.php.net/repository/pear/packages/Archive_Tar/trunk/package.xml',
+ 'kind' => 'file',
+ 'props' => 'none',
+ 'item' => 'modified',
+ ),
+ ),
+)
+tests done
+
View
@@ -0,0 +1,70 @@
+--TEST--
+test diff
+--SKIPIF--
+--FILE--
+<?php
+require_once dirname(__FILE__) . '/setup.php.inc';
+
+$changeset = '325013';
+$url = 'https://github.com/pear/VersionControl_SVN/tags/0.5.0/docs';
+
+$options = array('fetchmode' => VERSIONCONTROL_SVN_FETCHMODE_ASSOC);
+$switches = array();
+
+$svn = VersionControl_SVN::factory(array('list'), $options);
+
+$result = $svn->list->run(array($url), $switches);
+
+var_export($result);
+echo "\ntests done\n";
+?>
+--CLEAN--
+--EXPECT--
+array (
+ 'list' =>
+ array (
+ 0 =>
+ array (
+ 'entry' =>
+ array (
+ 0 =>
+ array (
+ 'name' => 'LICENSE',
+ 'size' => '1495',
+ 'commit' =>
+ array (
+ 'author' => 'michiel.rook',
+ 'date' => '2012-11-19T18:34:37.000000Z',
+ 'revision' => '157',
+ ),
+ 'kind' => 'file',
+ ),
+ 1 =>
+ array (
+ 'name' => 'examples',
+ 'commit' =>
+ array (
+ 'author' => 'michiel.rook',
+ 'date' => '2012-11-19T18:34:37.000000Z',
+ 'revision' => '157',
+ ),
+ 'kind' => 'dir',
+ ),
+ 2 =>
+ array (
+ 'name' => 'tutorials',
+ 'commit' =>
+ array (
+ 'author' => 'michiel.rook',
+ 'date' => '2012-11-19T18:34:37.000000Z',
+ 'revision' => '157',
+ ),
+ 'kind' => 'dir',
+ ),
+ ),
+ 'path' => 'https://github.com/pear/VersionControl_SVN/tags/0.5.0/docs',
+ ),
+ ),
+)
+tests done
+
View
@@ -0,0 +1,36 @@
+--TEST--
+test diff
+--SKIPIF--
+--FILE--
+<?php
+require_once dirname(__FILE__) . '/setup.php.inc';
+
+$changeset = '325013';
+$url = 'http://svn.php.net/repository/pear';
+
+$options = array('fetchmode' => VERSIONCONTROL_SVN_FETCHMODE_ASSOC);
+$switches = array('c' => $changeset);
+
+$svn = VersionControl_SVN::factory(array('log'), $options);
+
+$result = $svn->log->run(array($url), $switches);
+
+var_export($result);
+echo "\ntests done\n";
+?>
+--CLEAN--
+--EXPECT--
+array (
+ 'logentry' =>
+ array (
+ 0 =>
+ array (
+ 'author' => 'mrook',
+ 'date' => '2012-04-10T17:29:01.795698Z',
+ 'msg' => 'Update changelog',
+ 'revision' => '325013',
+ ),
+ ),
+)
+tests done
+
Oops, something went wrong.

0 comments on commit 1b566a6

Please sign in to comment.