From f624c50cfcbd072914d01247bd0daf2c38ba6a64 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Nov 09 2015 15:55:33 +0000 Subject: add patch to skip online tests --- diff --git a/php-nette-utils-pr91.patch b/php-nette-utils-pr91.patch new file mode 100644 index 0000000..caea7a8 --- /dev/null +++ b/php-nette-utils-pr91.patch @@ -0,0 +1,51 @@ +From cddddd0fa49f1b0eeb19be18389711222b1a0aee Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Mon, 9 Nov 2015 16:52:13 +0100 +Subject: [PATCH] allow to skip online tests + +--- + tests/Utils/FileSystem.phpt | 24 ++++++++++++++++++------ + 1 file changed, 18 insertions(+), 6 deletions(-) + +diff --git a/tests/Utils/FileSystem.phpt b/tests/Utils/FileSystem.phpt +index 68871f2..2a0c96c 100644 +--- a/tests/Utils/FileSystem.phpt ++++ b/tests/Utils/FileSystem.phpt +@@ -41,8 +41,13 @@ test(function () { // copy + FileSystem::copy(TEMP_DIR . '/3/file', TEMP_DIR . '/3/x/file'); + Assert::same('Hello', file_get_contents(TEMP_DIR . '/3/x/file')); + +- FileSystem::copy('http://example.com', TEMP_DIR . '/3/x/y/file'); +- Assert::true(is_file(TEMP_DIR . '/3/x/y/file')); ++ if (getenv('SKIP_ONLINE_TESTS') ?: false) { ++ FileSystem::copy(__FILE__, TEMP_DIR . '/3/x/y/file'); ++ Assert::true(is_file(TEMP_DIR . '/3/x/y/file')); ++ } else { ++ FileSystem::copy('http://example.com', TEMP_DIR . '/3/x/y/file'); ++ Assert::true(is_file(TEMP_DIR . '/3/x/y/file')); ++ } + + FileSystem::write(TEMP_DIR . '/5/newfile', 'World'); + +@@ -51,10 +56,17 @@ test(function () { // copy + }, 'Nette\InvalidStateException', "File or directory '%a%' already exists."); + Assert::same('Hello', file_get_contents(TEMP_DIR . '/3/x/file')); + +- Assert::exception(function () { +- FileSystem::copy('http://example.com', TEMP_DIR . '/3/x/file', FALSE); +- }, 'Nette\InvalidStateException', "File or directory '%a%' already exists."); +- Assert::same('Hello', file_get_contents(TEMP_DIR . '/3/x/file')); ++ if (getenv('SKIP_ONLINE_TESTS') ?: false) { ++ Assert::exception(function () { ++ FileSystem::copy(__FILE__, TEMP_DIR . '/3/x/file', FALSE); ++ }, 'Nette\InvalidStateException', "File or directory '%a%' already exists."); ++ Assert::same('Hello', file_get_contents(TEMP_DIR . '/3/x/file')); ++ } else { ++ Assert::exception(function () { ++ FileSystem::copy('http://example.com', TEMP_DIR . '/3/x/file', FALSE); ++ }, 'Nette\InvalidStateException', "File or directory '%a%' already exists."); ++ Assert::same('Hello', file_get_contents(TEMP_DIR . '/3/x/file')); ++ } + + FileSystem::copy(TEMP_DIR . '/5/newfile', TEMP_DIR . '/3/x/file'); + Assert::same('World', file_get_contents(TEMP_DIR . '/3/x/file')); diff --git a/php-nette-utils.spec b/php-nette-utils.spec index 21558ed..af335e7 100644 --- a/php-nette-utils.spec +++ b/php-nette-utils.spec @@ -28,6 +28,9 @@ Source0: %{name}-%{version}-%{gh_short}.tgz # pull a git snapshot to get test sutie Source1: makesrc.sh +# https://github.com/nette/utils/pull/91 +Patch0: %{name}-pr91.patch + BuildArch: noarch BuildRequires: php-composer(theseer/autoload) %if %{with_tests} @@ -92,6 +95,8 @@ To use this library, you just have to add, in your project: %prep %setup -q -n %{gh_project}-%{gh_commit} +%patch0 -p1 + %build : Generate a classmap autoloader @@ -123,6 +128,7 @@ require_once '%{buildroot}%{php_home}/%{ns_vendor}/Utils/autoload.php'; EOF : Run test suite in sources tree +SKIP_ONLINE_TESTS=1 \ nette-tester --colors 0 -p php -c ./php.ini tests -s %else : Test suite disabled @@ -141,4 +147,5 @@ nette-tester --colors 0 -p php -c ./php.ini tests -s %changelog * Tue Oct 20 2015 Remi Collet - 2.3.6-1 -- initial package \ No newline at end of file +- initial package +- open https://github.com/nette/utils/pull/91 \ No newline at end of file