Browse Source

[TESTS] Improvements

- Deleted tests broken Zend_Queue;
- Add Adapter in Zend_Queue_AllTest;
- Missing require_once in Zend_OpenI.

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@24332 44c647ce-9c0f-0410-b52a-842ac1e357ba
ramon 14 years ago
parent
commit
d09355030c

+ 5 - 0
tests/Zend/OpenId/ProviderTest.php

@@ -31,6 +31,11 @@ require_once 'Zend/OpenId/Provider.php';
 require_once 'Zend/OpenId/ResponseHelper.php';
 
 /**
+ * @see Zend_OpenId_Provider_User_Session
+ */
+require_once 'Zend/OpenId/Provider/User/Session.php';
+
+/**
  * @category   Zend
  * @package    Zend_OpenId
  * @subpackage UnitTests

+ 0 - 196
tests/Zend/Queue/Adapter/StompIOTest.php

@@ -1,196 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category   Zend
- * @package    Zend_Queue
- * @subpackage UnitTests
- * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id$
- */
-
-/*
- * The adapter test class provides a universal test class for all of the
- * abstract methods.
- *
- * All methods marked not supported are explictly checked for for throwing
- * an exception.
- */
-
-/** Zend/Queue/Adapter/Stomp/IO.php */
-require_once 'Zend/Queue/Adapter/Stomp/IO.php';
-
-/**
- * @category   Zend
- * @package    Zend_Queue
- * @subpackage UnitTests
- * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @group      Zend_Queue
- */
-class Zend_Queue_Adapter_StompIOTest extends PHPUnit_Framework_TestCase
-{
-    protected $config = array(
-        'scheme' => 'tcp',
-        'host'   => '127.0.0.1',
-        'port'   => 61613,
-    );
-
-    protected $io = false;
-
-    protected $body = 'hello world'; // 11 characters
-
-    public function setUp()
-    {
-        if ( $this->io === false ) {
-            $this->io = new Zend_Queue_Adapter_Stomp_IO($this->config);
-        }
-    }
-
-    public function test_constructFrame()
-    {
-        $frame = $this->io->constructFrame('SEND', array(), $this->body);
-
-        $correct = 'SEND' . Zend_Queue_Adapter_Stomp_IO::EOL;
-        $correct .= 'content-length: 11' . Zend_Queue_Adapter_Stomp_IO::EOL;
-        $correct .= Zend_Queue_Adapter_Stomp_IO::EOL;
-        $correct .= $this->body;
-        $correct .= Zend_Queue_Adapter_Stomp_IO::END_OF_FRAME;
-
-        $this->assertEquals($frame, $correct);
-
-        // validate parameters
-        try {
-            $frame = $this->io->constructFrame(array());
-            $this->fail('constructFrame() should have failed $action as an array');
-        } catch (Exception $e) {
-            $this->assertTrue(true);
-        }
-
-        try { // this won't test, I think because phpunit suppresses the error
-            $frame = $this->io->constructFrame('SEND', 'string');
-            $this->fail('constructFrame() should have failed $headers as a string');
-        } catch (Exception $e) {
-            $this->assertTrue(true);
-        }
-
-        try { // this won't test, I think because phpunit suppresses the error
-            $frame = $this->io->constructFrame('SEND', array(), array());
-            $this->fail('constructFrame() should have failed $body as a array');
-        } catch (Exception $e) {
-            $this->assertTrue(true);
-        }
-    }
-
-    public function test_deconstructFrame()
-    {
-        $correct = array(
-            'headers' => array(),
-            'body' => $this->body,
-            'command' => 'SEND'
-        );
-
-        $frame = $this->io->constructFrame($correct['command'], array(), $correct['body']);
-        $frame = $this->io->deconstructFrame($frame);
-        $this->assertEquals($correct['command'], $frame['command']);
-        $this->assertEquals($correct['body'], $frame['body']);
-
-        // validate parameters
-        try {
-            $frame = $this->io->deconstructFrame(array());
-            $this->fail('deconstructFrame() should have failed with an array');
-        } catch (Exception $e) {
-            $this->assertTrue(true);
-        }
-    }
-
-    public function test_write_read()
-    {
-        $frame = $this->io->constructFrame('CONNECT');
-        $frame = $this->io->writeAndRead($frame);
-
-        $headers = array(
-            'destination' => '/queue/testing',
-            'ack' => 'auto'
-        );
-
-        $frame = $this->io->constructFrame('SEND', $headers, $this->body);
-        $this->io->write($frame);
-
-        $frame = $this->io->constructFrame('SUBSCRIBE', $headers);
-        $this->io->write($frame);
-
-        $frame = $this->io->read();
-        $frame = $this->io->deconstructFrame($frame);
-
-        $this->assertEquals($this->body, $frame['body']);
-
-        // validate parameters
-        try {
-            $frame = $this->io->write(array());
-            $this->fail('write() should have failed with an array');
-        } catch (Exception $e) {
-            $this->assertTrue(true);
-        }
-    }
-
-    public function test_open_close()
-    {
-        try {
-            $obj = new Zend_Queue_Adapter_Stomp_IO($this->config);
-        } catch (Exception $e) {
-            $this->fail('failed to create Zend_Queue_Adapter_Stomp_IO object:' . $e->getMessage());
-        }
-
-        try {
-            $obj->close();
-        } catch (Exception $e) {
-            $this->fail('failed to close Zend_Queue_Adapter_Stomp_IO object:' . $e->getMessage());
-        }
-
-        // validate parameters
-        $config = array(
-            'scheme' => 'tcp',
-            'host' => 'blahblahb asfd',
-            'port' => '0'
-        );
-
-        try {
-            $frame = $this->io->open($config);
-            $this->fail('open() should have failed with an invalid configuration');
-        } catch (Exception $e) {
-            $this->assertTrue(true);
-        }
-    }
-
-    public function test_constant()
-    {
-        $this->assertTrue(is_string(Zend_Queue_Adapter_Stomp_IO::END_OF_FRAME));
-        $this->assertTrue(is_string(Zend_Queue_Adapter_Stomp_IO::CONTENT_LENGTH));
-        $this->assertTrue(is_string(Zend_Queue_Adapter_Stomp_IO::EOL));
-    }
-
-    public function test_checkSocket()
-    {
-        $this->assertTrue($this->io->checkSocket());
-        $this->io->close();
-
-        try {
-            $this->io->checkSocket();
-            $this->fail('checkSocket() should have failed on a fclose($socket)');
-        } catch (Exception $e) {
-            $this->assertTrue(true);
-        }
-    }
-}

+ 0 - 104
tests/Zend/Queue/Adapter/StompTest.php

@@ -1,104 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category   Zend
- * @package    Zend_Queue
- * @subpackage UnitTests
- * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id$
- */
-
-/*
- * The adapter test class provides a universal test class for all of the
- * abstract methods.
- *
- * All methods marked not supported are explictly checked for for throwing
- * an exception.
- */
-
-/** Zend_Queue */
-require_once 'Zend/Queue.php';
-
-/** Zend_Queue */
-require_once 'Zend/Queue/Message.php';
-
-/** Zend_Queue_Message_Test */
-require_once 'MessageTestClass.php';
-
-/** Base Adapter test class */
-require_once dirname(__FILE__) . '/AdapterTest.php';
-
-/**
- * @category   Zend
- * @package    Zend_Queue
- * @subpackage UnitTests
- * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @group      Zend_Queue
- */
-class Zend_Queue_Adapter_StompTest extends Zend_Queue_Adapter_AdapterTest
-{
-    /**
-     * getAdapterName() is an method to help make AdapterTest work with any
-     * new adapters
-     *
-     * You must overload this method
-     *
-     * @return string
-     */
-    public function getAdapterName()
-    {
-        return 'Stomp';
-    }
-
-    /**
-     * getAdapterName() is an method to help make AdapterTest work with any
-     * new adapters
-     *
-     * You may overload this method.  The default return is
-     * 'Zend_Queue_Adapter_' . $this->getAdapterName()
-     *
-     * @return string
-     */
-    public function getAdapterFullName()
-    {
-        return 'Zend_Queue_Adapter_' . $this->getAdapterName();
-    }
-
-    public function getTestConfig()
-    {
-        return array('driverOptions' => array('host' => '127.0.0.1',
-                                              'port' => '61613'));
-    }
-
-    /**
-     * Stomped requires specific name types
-     */
-    public function createQueueName($name)
-    {
-        return '/temp-queue/' . $name;
-    }
-
-    public function testConst()
-    {
-        /**
-         * @see Zend_Queue_Adapter_Stomp
-         */
-        require_once 'Zend/Queue/Adapter/Stomp.php';
-        $this->assertTrue(is_string(Zend_Queue_Adapter_Stomp::DEFAULT_SCHEME));
-        $this->assertTrue(is_string(Zend_Queue_Adapter_Stomp::DEFAULT_HOST));
-        $this->assertTrue(is_integer(Zend_Queue_Adapter_Stomp::DEFAULT_PORT));
-    }
-}

+ 1 - 0
tests/Zend/Queue/AllTests.php

@@ -35,6 +35,7 @@ require_once 'Zend/Queue/MessageTest.php';
 require_once 'Zend/Queue/Message/IteratorTest.php';
 
 // Adapter testing
+require_once 'Zend/Queue/Adapter/AdapterTest.php';
 require_once 'Zend/Queue/Adapter/ArrayTest.php';
 require_once 'Zend/Queue/Adapter/MemcacheqTest.php';
 require_once 'Zend/Queue/Adapter/NullTest.php';