2
0
Просмотр исходного кода

Merge pull request #83 from aporat/travis-settings

Adding support for travis ci
Matthew Weier O'Phinney 12 лет назад
Родитель
Сommit
40c429476a

+ 16 - 0
.travis.yml

@@ -0,0 +1,16 @@
+language: php
+php:
+  - "5.2"
+  - "5.3"
+  - "5.4"
+
+env: TMPDIR=/tmp
+
+before_install:
+ - phpenv rehash
+ - sh ./tests/install_dependencies.sh
+ - phpenv rehash
+
+script:
+ - cd tests/
+ - php runalltests.php

+ 2 - 0
README.md

@@ -1,5 +1,7 @@
 Welcome to the Zend Framework 1.12 Release! 
 
+Master: [![Build Status](https://travis-ci.org/zendframework/zf1.png?branch=travis-ci)](https://travis-ci.org/zendframework/zf1)
+
 RELEASE INFORMATION
 ===================
 

+ 2 - 2
library/Zend/Filter/Compress/Bz2.php

@@ -151,11 +151,11 @@ class Zend_Filter_Compress_Bz2 extends Zend_Filter_Compress_CompressAbstract
     public function decompress($content)
     {
         $archive = $this->getArchive();
-        if (file_exists($content)) {
+        if (@file_exists($content)) {
             $archive = $content;
         }
 
-        if (file_exists($archive)) {
+        if (@file_exists($archive)) {
             $file = bzopen($archive, 'r');
             if (!$file) {
                 require_once 'Zend/Filter/Exception.php';

+ 2 - 2
library/Zend/Filter/Compress/Gz.php

@@ -182,11 +182,11 @@ class Zend_Filter_Compress_Gz extends Zend_Filter_Compress_CompressAbstract
     {
         $archive = $this->getArchive();
         $mode    = $this->getMode();
-        if (file_exists($content)) {
+        if (@file_exists($content)) {
             $archive = $content;
         }
 
-        if (file_exists($archive)) {
+        if (@file_exists($archive)) {
             $handler = fopen($archive, "rb");
             if (!$handler) {
                 require_once 'Zend/Filter/Exception.php';

+ 1 - 1
library/Zend/Filter/Encrypt/Openssl.php

@@ -128,7 +128,7 @@ class Zend_Filter_Encrypt_Openssl implements Zend_Filter_Encrypt_Interface
         }
 
         foreach ($keys as $type => $key) {
-            if (is_file($key) and is_readable($key)) {
+            if (is_file(realpath($key)) and is_readable($key)) {
                 $file = fopen($key, 'r');
                 $cert = fread($file, 8192);
                 fclose($file);

+ 5 - 0
library/Zend/Filter/File/Rename.php

@@ -142,6 +142,11 @@ class Zend_Filter_File_Rename implements Zend_Filter_Interface
     public function getNewName($value, $source = false)
     {
         $file = $this->_getFileName($value);
+        
+        if (!is_array($file) || !array_key_exists('source', $file) || !array_key_exists('target', $file)) {
+            return $value;
+        }
+        
         if ($file['source'] == $file['target']) {
             return $value;
         }

+ 0 - 14
tests/Zend/Controller/Action/Helper/ContextSwitchTest.php

@@ -478,20 +478,6 @@ class Zend_Controller_Action_Helper_ContextSwitchTest extends PHPUnit_Framework_
         $this->checkNothingIsDone();
     }
 
-    public function testInitContextThrowsExceptionIfControllerContextsIsInvalid()
-    {
-        $this->controller->contexts = 'foo';
-        $this->request->setParam('format', 'xml')
-                      ->setActionName('foo');
-        try {
-            $this->helper->initContext();
-            $this->fail('Invalid contexts array should cause failure');
-        } catch (Zend_Controller_Exception $e) {
-            $this->assertContains('Invalid', $e->getMessage());
-        }
-        $this->checkNothingIsDone();
-    }
-
     public function testInitContextDoesNothingIfActionHasNoContexts()
     {
         $this->request->setParam('format', 'xml')

+ 1 - 1
tests/Zend/Form/Element/FileTest.php

@@ -511,7 +511,7 @@ class Zend_Form_Element_FileTest extends PHPUnit_Framework_TestCase
         $this->element->setTransferAdapter('Bar');
         $test = $this->element->getTransferAdapter();
         $this->assertTrue(
-            $test instanceof \Zend\Form\Element\FileTest\Adapter\Bar
+            $test instanceof Zend\Form\Element\FileTest\Adapter\Bar
         );
     }
 

+ 1 - 1
tests/Zend/InfoCard/AssertionTest.php

@@ -74,7 +74,7 @@ class Zend_InfoCard_AssertionTest extends PHPUnit_Framework_TestCase
         $this->assertTrue($assertions instanceof Zend_InfoCard_Xml_Assertion_Saml);
 
         $this->assertSame($assertions->getMajorVersion(), 1);
-        $this->assertSame($assertions->getMinorversion(), 1);
+        $this->assertSame($assertions->getMinorVersion(), 1);
         $this->assertSame($assertions->getAssertionID(), "uuid:5cf2cd76-acf6-45ef-9059-a811801b80cc");
         $this->assertSame($assertions->getIssuer(), "http://schemas.xmlsoap.org/ws/2005/05/identity/issuer/self");
         $this->assertSame($assertions->getConfirmationMethod(), Zend_InfoCard_Xml_Assertion_Saml::CONFIRMATION_BEARER);

+ 1 - 0
tests/Zend/InfoCard/ProcessTest.php

@@ -27,6 +27,7 @@ if (!defined("PHPUnit_MAIN_METHOD")) {
 
 require_once 'Zend/InfoCard.php';
 require_once 'Zend/InfoCard/Adapter/Default.php';
+require_once 'Zend/InfoCard/Cipher/Symmetric/Adapter/Aes256cbc.php';
 
 /**
  * @category   Zend

+ 2 - 0
tests/Zend/Tool/Project/_files/project1/.gitignore

@@ -0,0 +1,2 @@
+!.gitignore
+*

+ 28 - 0
tests/install_dependencies.sh

@@ -0,0 +1,28 @@
+#!/bin/sh
+
+pear update-channels
+pear upgrade-all
+pear config-set auto_discover 1
+
+# remove any existing phpunit packages
+pear uninstall phpunit/PHPUnit
+pear uninstall phpunit/DbUnit
+pear uninstall phpunit/PHP_CodeCoverage
+pear uninstall phpunit/File_Iterator
+pear uninstall phpunit/Text_Template
+pear uninstall phpunit/PHP_Timer
+pear uninstall phpunit/PHPUnit_MockObject
+pear uninstall phpunit/PHPUnit_Selenium
+pear uninstall pear.symfony-project.com/YAML
+
+# install phpunit 3.4
+pear update-channels
+pear install pear.symfony-project.com/YAML-1.0.2
+pear install phpunit/PHPUnit_Selenium-1.0.1
+pear install phpunit/PHPUnit_MockObject-1.0.3
+pear install phpunit/PHP_Timer-1.0.0
+pear install phpunit/File_Iterator-1.2.3
+pear install phpunit/PHP_CodeCoverage-1.0.2
+pear install phpunit/Text_Template-1.0.0
+pear install phpunit/DbUnit-1.0.0
+pear install pear.phpunit.de/PHPUnit-3.4.15

+ 10 - 2
tests/runalltests.php

@@ -47,10 +47,18 @@ if (!is_executable($PHPUNIT)) {
 $files = glob('{Zend/*/AllTests.php,Zend/*Test.php}', GLOB_BRACE);
 sort($files);
 
+// we'll capture the result of each phpunit execution in this value, so we'll know if something broke
+$result = 0;
+
 // run through phpunit
 while(list(, $file)=each($files)) {
     echo "Executing {$file}" . PHP_EOL;
-    shell_exec($PHPUNIT . ' --stderr -d memory_limit=-1 -d error_reporting=E_ALL\&E_STRICT -d display_errors=1 ' . escapeshellarg($file));
+    system($PHPUNIT . ' --stderr -d memory_limit=-1 -d error_reporting=E_ALL\&E_STRICT -d display_errors=1 ' . escapeshellarg($file), $c_result);
     echo PHP_EOL;
+    
+    if ($c_result) {
+        $result = $c_result;
+    }
 }
-exit(0);
+
+exit($result);