Overview

Packages

  • alpha::controller
  • alpha::controller::front
  • alpha::exceptions
  • alpha::model
  • alpha::model::types
  • alpha::tasks
  • alpha::tests
  • alpha::util
  • alpha::util::cache
  • alpha::util::codehighlight
  • alpha::util::convertors
  • alpha::util::feeds
  • alpha::util::filters
  • alpha::util::graphs
  • alpha::util::helpers
  • alpha::util::metrics
  • alpha::util::search
  • alpha::view
  • alpha::view::renderers
  • alpha::view::widgets

Classes

  • AlphaAgentUtils_Test
  • AlphaConfig_Test
  • AlphaController_Test
  • AlphaDAO_Test
  • AlphaDAOProviderFactory_Test
  • AlphaFeed_Test
  • AlphaFilters_Test
  • AlphaPHPServerUtils_Test
  • AlphaValidator_Test
  • AlphaView_Test
  • Boolean_Test
  • Date_Test
  • DEnum_Test
  • Double_Test
  • Enum_Test
  • Exceptions_Test
  • FrontController_Test
  • Image_Test
  • Integer_Test
  • Relation_Test
  • RelationLookup_Test
  • SearchProviderTags_Test
  • Sequence_Test
  • String_Test
  • Tag_Test
  • Text_Test
  • Timestamp_Test
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
 1: <?php
 2: 
 3: /**
 4:  * Test cases for the AlphaDAOProviderFactory class.
 5:  *
 6:  * @package alpha::tests
 7:  * @since 1.2.1
 8:  * @author John Collins <dev@alphaframework.org>
 9:  * @version $Id: AlphaDAOProviderFactory_Test.php 1612 2012-12-18 12:16:22Z alphadevx $
10:  * @license http://www.opensource.org/licenses/bsd-license.php The BSD License
11:  * @copyright Copyright (c) 2012, John Collins (founder of Alpha Framework).
12:  * All rights reserved.
13:  *
14:  * <pre>
15:  * Redistribution and use in source and binary forms, with or
16:  * without modification, are permitted provided that the
17:  * following conditions are met:
18:  *
19:  * * Redistributions of source code must retain the above
20:  *   copyright notice, this list of conditions and the
21:  *   following disclaimer.
22:  * * Redistributions in binary form must reproduce the above
23:  *   copyright notice, this list of conditions and the
24:  *   following disclaimer in the documentation and/or other
25:  *   materials provided with the distribution.
26:  * * Neither the name of the Alpha Framework nor the names
27:  *   of its contributors may be used to endorse or promote
28:  *   products derived from this software without specific
29:  *   prior written permission.
30:  *
31:  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
32:  * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
33:  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
34:  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
35:  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
36:  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
37:  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
38:  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
39:  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
40:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
41:  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
42:  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
43:  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
44:  * </pre>
45:  *
46:  */
47: class AlphaDAOProviderFactory_Test extends PHPUnit_Framework_TestCase {
48: 
49:     /**
50:      * Testing the getInstance() method with good parameters
51:      *
52:      * @since 1.2.1
53:      */
54:     public function testGetInstanceGood() {
55:         $provider = AlphaDAOProviderFactory::getInstance('AlphaDAOProviderSQLite', new PersonObject());
56: 
57:         $this->assertTrue($provider instanceof AlphaDAOProviderInterface, 'testing the getInstance() method with good parameters');
58:         $this->assertTrue($provider instanceof AlphaDAOProviderSQLite, 'testing the getInstance() method with good parameters');
59:     }
60: 
61:     /**
62:      * Testing the getInstance() method with bad parameters
63:      *
64:      * @since 1.2.1
65:      */
66:     public function testGetInstanceBad() {
67: 
68:         try {
69:             $provider = AlphaDAOProviderFactory::getInstance('AlphaDAOProviderDoesNotExist', new PersonObject());
70:             $this->fail('testing the getInstance() method with bad parameters');
71:         }catch (IllegalArguementException $e) {
72:             $this->assertEquals('The class [AlphaDAOProviderDoesNotExist] is not defined anywhere!', $e->getMessage(), 'testing the getInstance() method with bad parameters');
73:         }
74: 
75:         try {
76:             $provider = AlphaDAOProviderFactory::getInstance('AlphaDAOProviderFactory', new PersonObject());
77:             $this->fail('testing the getInstance() method with bad parameters');
78:         }catch (IllegalArguementException $e) {
79:             $this->assertEquals('The class [AlphaDAOProviderFactory] does not implement the expected AlphaDAOProviderInterface interface!', $e->getMessage(), 'testing the getInstance() method with bad parameters');
80:         }
81:     }
82: }
83: 
84: ?>
Alpha Framework 1.2.4 API Documentation API documentation generated by ApiGen 2.8.0