Changeset 1250
- Timestamp:
- 01/17/08 00:47:31 (9 months ago)
- Files:
-
- trunk/src/main/php/net/stubbles/websites/stubFrontController.php (modified) (1 diff)
- trunk/src/test/AllTests.php (modified) (2 diffs)
- trunk/src/test/php/net/stubbles/websites/TeststubFrontController.php (deleted)
- trunk/src/test/php/net/stubbles/websites/WebsitesTestSuite.php (modified) (1 diff)
- trunk/src/test/php/net/stubbles/websites/stubFrontControllerTestCase.php (moved) (moved from trunk/src/test/php/net/stubbles/websites/stubFrontControllerProcessTestCase.php) (12 diffs)
- trunk/src/test/php/net/stubbles/websites/stubPageTestCase.php (modified) (6 diffs)
- trunk/src/test/run.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/net/stubbles/websites/stubFrontController.php
r1242 r1250 16 16 'net::stubbles::websites::cache::stubWebsiteCacheFactory', 17 17 'net::stubbles::websites::processors::stubProcessorResolverFactory' 18 19 18 ); 20 19 /** trunk/src/test/AllTests.php
r1236 r1250 26 26 require_once $dir . '/php/net/stubbles/events/EventTestSuite.php'; 27 27 require_once $dir . '/php/net/stubbles/ioc/IOCTestSuite.php'; 28 require_once $dir . '/php/net/stubbles/websites/WebsitesTestSuite.php'; 28 29 /** 29 30 * Class to organize all tests. … … 54 55 $suite->addTestSuite('EventTestSuite'); 55 56 $suite->addTestSuite('IOCTestSuite'); 57 $suite->addTestSuite('WebsitesTestSuite'); 56 58 return $suite; 57 59 } trunk/src/test/php/net/stubbles/websites/WebsitesTestSuite.php
r1136 r1250 13 13 * @subpackage test 14 14 */ 15 class WebsitesTestSuite extends TestSuite15 class WebsitesTestSuite extends PHPUnit_Framework_TestSuite 16 16 { 17 17 /** 18 * constructor 18 * returns the test suite to be run 19 * 20 * @return PHPUnit_Framework_TestSuite 19 21 */ 20 public function __construct()22 public static function suite() 21 23 { 24 $suite = new self(); 22 25 $dir = dirname(__FILE__); 23 $this->TestSuite('All websites classes tests'); 24 $this->addTestFile($dir . '/stubFrontControllerProcessTestCase.php'); 25 $this->addTestFile($dir . '/stubPageTestCase.php'); 26 $suite->addTestFile($dir . '/stubFrontControllerTestCase.php'); 27 $suite->addTestFile($dir . '/stubPageTestCase.php'); 26 28 27 29 // cache tests 28 $this->addTestFile($dir . '/cache/stubAbstractWebsiteCacheTestCase.php');29 $ this->addTestFile($dir . '/cache/stubDefaultWebsiteCacheFactoryTestCase.php');30 $ this->addTestFile($dir . '/cache/stubDefaultWebsiteCacheTestCase.php');31 $ this->addTestFile($dir . '/cache/stubGzipWebsiteCacheTestCase.php');30 /*$suite->addTestFile($dir . '/cache/stubAbstractWebsiteCacheTestCase.php'); 31 $suite->addTestFile($dir . '/cache/stubDefaultWebsiteCacheFactoryTestCase.php'); 32 $suite->addTestFile($dir . '/cache/stubDefaultWebsiteCacheTestCase.php'); 33 $suite->addTestFile($dir . '/cache/stubGzipWebsiteCacheTestCase.php');*/ 32 34 33 35 // memphis tests 34 $this->addTestFile($dir . '/memphis/stubMemphisIncludeFilePageElementTestCase.php');35 $ this->addTestFile($dir . '/memphis/stubMemphisPageElementTestCase.php');36 $ this->addTestFile($dir . '/memphis/stubMemphisProcessorTestCase.php');36 /*$suite->addTestFile($dir . '/memphis/stubMemphisIncludeFilePageElementTestCase.php'); 37 $suite->addTestFile($dir . '/memphis/stubMemphisPageElementTestCase.php'); 38 $suite->addTestFile($dir . '/memphis/stubMemphisProcessorTestCase.php');*/ 37 39 38 40 // processors tests 39 $this->addTestFile($dir . '/processors/stubAbstractProcessorResolverTestCase.php');40 $ this->addTestFile($dir . '/processors/stubDefaultProcessorResolverTestCase.php');41 $ this->addTestFile($dir . '/processors/stubProcessorResolverXJConfFactoryTestCase.php');42 $ this->addTestFile($dir . '/processors/stubSimpleProcessorResolverTestCase.php');41 /*$suite->addTestFile($dir . '/processors/stubAbstractProcessorResolverTestCase.php'); 42 $suite->addTestFile($dir . '/processors/stubDefaultProcessorResolverTestCase.php'); 43 $suite->addTestFile($dir . '/processors/stubProcessorResolverXJConfFactoryTestCase.php'); 44 $suite->addTestFile($dir . '/processors/stubSimpleProcessorResolverTestCase.php');*/ 43 45 44 46 // xml tests 45 $this->addTestFile($dir . '/xml/stubShowLastXMLInterceptorTestCase.php'); 46 $this->addTestFile($dir . '/xml/stubXMLPostInterceptorTestCase.php'); 47 $this->addTestFile($dir . '/xml/stubXMLProcessorTestCase.php'); 48 $this->addTestFile($dir . '/xml/stubXMLResponseTestCase.php'); 47 /*$suite->addTestFile($dir . '/xml/stubShowLastXMLInterceptorTestCase.php'); 48 $suite->addTestFile($dir . '/xml/stubXMLPostInterceptorTestCase.php'); 49 $suite->addTestFile($dir . '/xml/stubXMLProcessorTestCase.php'); 50 $suite->addTestFile($dir . '/xml/stubXMLResponseTestCase.php');*/ 51 return $suite; 49 52 } 50 53 } trunk/src/test/php/net/stubbles/websites/stubFrontControllerTestCase.php
r1231 r1250 8 8 */ 9 9 stubClassLoader::load('net::stubbles::websites::stubFrontController'); 10 Mock::generate('stubRequest'); 11 Mock::generate('stubSession'); 12 Mock::generate('stubResponse'); 13 Mock::generate('stubPostInterceptor'); 14 Mock::generate('stubPreInterceptor'); 15 Mock::generate('stubProcessor'); 16 Mock::generate('stubProcessorResolver'); 17 Mock::generate('stubInterceptorInitializer'); 18 Mock::generate('stubProcessorResolverFactory'); 19 Mock::generate('stubRegistryInitializer'); 20 Mock::generate('stubWebsiteCacheFactory'); 21 require_once dirname(__FILE__) . '/TeststubFrontController.php'; 10 /** 11 * Class that extends the front controller to make it testable. 12 * 13 * @package stubbles 14 * @subpackage websites_test 15 */ 16 class TeststubFrontController extends stubFrontController 17 { 18 /** 19 * returns the created request instance 20 * 21 * @return stubRequest 22 */ 23 public function getRequest() 24 { 25 return $this->request; 26 } 27 28 /** 29 * returns the created session instance 30 * 31 * @return stubSession 32 */ 33 public function getSession() 34 { 35 return $this->session; 36 } 37 38 /** 39 * sets the response instance 40 * 41 * @return stubResponse 42 */ 43 public function setResponse(stubResponse $response) 44 { 45 $this->response = $response; 46 } 47 } 22 48 /** 23 49 * Tests for net::stubbles::websites::stubFrontController. … … 26 52 * @subpackage websites_test 27 53 */ 28 class stubFrontControllerProcessTestCase extends UnitTestCase54 class stubFrontControllerProcessTestCase extends PHPUnit_Framework_TestCase 29 55 { 30 56 /** … … 37 63 * mocked interceptor initializer 38 64 * 39 * @var SimpleMock65 * @var PHPUnit_Framework_MockObject_MockObject 40 66 */ 41 67 protected $mockInterceptorInitializer; … … 43 69 * access to request 44 70 * 45 * @var SimpleMock71 * @var PHPUnit_Framework_MockObject_MockObject 46 72 */ 47 73 protected $mockRequest; … … 49 75 * access to session 50 76 * 51 * @var SimpleMock77 * @var PHPUnit_Framework_MockObject_MockObject 52 78 */ 53 79 protected $mockSession; … … 55 81 * access to response 56 82 * 57 * @var SimpleMock83 * @var PHPUnit_Framework_MockObject_MockObject 58 84 */ 59 85 protected $mockResponse; … … 61 87 * access to response 62 88 * 63 * @var SimpleMock89 * @var PHPUnit_Framework_MockObject_MockObject 64 90 */ 65 91 protected $mockResponse2; … … 67 93 * the mocked resolver 68 94 * 69 * @var SimpleMock95 * @var PHPUnit_Framework_MockObject_MockObject 70 96 */ 71 97 protected $mockProcessorResolver; … … 73 99 * the mocked processor 74 100 * 75 * @var SimpleMock101 * @var PHPUnit_Framework_MockObject_MockObject 76 102 */ 77 103 protected $mockProcessor; … … 79 105 * mocked website cache factory 80 106 * 81 * @var stubWebsiteCacheFactory107 * @var PHPUnit_Framework_MockObject_MockObject 82 108 */ 83 109 protected $mockWebsiteCacheFactory; … … 88 114 public function setUp() 89 115 { 90 $mockProcessorResolverFactory = new MockstubProcessorResolverFactory(); 91 $this->mockProcessorResolver = new MockstubProcessorResolver(); 92 $mockProcessorResolverFactory->setReturnValue('getResolver', $this->mockProcessorResolver); 93 $this->mockInterceptorInitializer = new MockstubInterceptorInitializer(); 94 $this->frontController = new TeststubFrontController(new MockstubRegistryInitializer(), $this->mockInterceptorInitializer, $mockProcessorResolverFactory); 95 $this->mockRequest = new MockstubRequest(); 96 $this->frontController->setRequest($this->mockRequest); 97 $this->mockSession = new MockstubSession(); 98 $this->frontController->setSession($this->mockSession); 99 $this->mockResponse = new MockstubResponse(); 116 $mockProcessorResolverFactory = $this->getMock('stubProcessorResolverFactory'); 117 $this->mockProcessorResolver = $this->getMock('stubProcessorResolver'); 118 $this->mockProcessor = $this->getMock('stubProcessor'); 119 $mockProcessorResolverFactory->expects($this->once()) 120 ->method('getResolver') 121 ->will($this->returnValue($this->mockProcessorResolver)); 122 $this->mockProcessorResolver->expects($this->once()) 123 ->method('resolve') 124 ->will($this->returnValue($this->mockProcessor)); 125 $this->mockInterceptorInitializer = $this->getMock('stubInterceptorInitializer'); 126 stubRegistry::setConfig(stubRequest::CLASS_REGISTRY_KEY, get_class($this->getMock('stubRequest'))); 127 stubRegistry::setConfig(stubSession::CLASS_REGISTRY_KEY, get_class($this->getMock('stubSession'))); 128 $this->frontController = new TeststubFrontController($this->getMock('stubRegistryInitializer'), $this->mockInterceptorInitializer, $mockProcessorResolverFactory); 129 130 $this->mockRequest = $this->frontController->getRequest(); 131 $this->mockSession = $this->frontController->getSession(); 132 $this->mockResponse = $this->getMock('stubResponse'); 100 133 $this->frontController->setResponse($this->mockResponse); 101 $this->mockProcessor = new MockstubProcessor(); 102 $this->mockProcessorResolver->setReturnValue('resolve', $this->mockProcessor); 103 $this->mockProcessor->setReturnValue('process', $this->mockProcessor); 104 $this->mockResponse2 = new MockstubResponse(); 105 $this->mockProcessor->setReturnValue('getResponse', $this->mockResponse2); 106 $this->mockWebsiteCacheFactory = new MockstubWebsiteCacheFactory(); 107 } 108 109 /** 110 * assure that processing ends when request is cancelled 111 */ 112 public function testProcessWithPreInterceptorCancellingRequest() 113 { 114 $preInterceptor1 = new MockstubPreInterceptor(); 115 $preInterceptor1->expectOnce('preProcess'); 116 $preInterceptor2 = new MockstubPreInterceptor(); 117 $preInterceptor2->expectNever('preProcess'); 118 $this->mockInterceptorInitializer->setReturnValue('getPreInterceptors', array($preInterceptor1, $preInterceptor2)); 119 $this->mockInterceptorInitializer->expectNever('getPostInterceptors'); 120 $this->mockRequest->expectOnce('isCancelled'); 121 $this->mockRequest->setReturnValue('isCancelled', true); 122 $this->mockResponse->expectOnce('send'); 123 $this->mockProcessorResolver->expectOnce('resolve'); 124 $this->mockProcessor->expectOnce('getInterceptorDescriptor'); 125 $this->mockProcessor->setReturnValue('getInterceptorDescriptor', 'interceptors'); 126 $this->mockProcessor->expectNever('process'); 127 $this->mockWebsiteCacheFactory->expectNever('configure'); 134 135 $this->mockWebsiteCacheFactory = $this->getMock('stubWebsiteCacheFactory'); 136 } 137 138 /** 139 * assure that processing ends when request is cancelled 140 * 141 * @test 142 */ 143 public function processWithPreInterceptorCancellingRequest() 144 { 145 $preInterceptor1 = $this->getMock('stubPreInterceptor'); 146 $preInterceptor1->expects($this->once())->method('preProcess'); 147 $preInterceptor2 = $this->getMock('stubPreInterceptor'); 148 $preInterceptor2->expects($this->never())->method('preProcess'); 149 $this->mockInterceptorInitializer->expects($this->once()) 150 ->method('getPreInterceptors') 151 ->will($this->returnValue(array($preInterceptor1, $preInterceptor2))); 152 $this->mockInterceptorInitializer->expects($this->never())->method('getPostInterceptors'); 153 $this->mockRequest->expects($this->once())->method('isCancelled')->will($this->returnValue(true)); 154 $this->mockResponse->expects($this->once())->method('send'); 155 $this->mockProcessor->expects($this->once()) 156 ->method('getInterceptorDescriptor') 157 ->will($this->returnValue('interceptors')); 158 $this->mockProcessor->expects($this->never())->method('process'); 159 $this->mockWebsiteCacheFactory->expects($this->never())->method('configure'); 128 160 $this->frontController->setWebsiteCacheFactory($this->mockWebsiteCacheFactory); 129 161 $this->frontController->process(); … … 132 164 /** 133 165 * assure that processing ends when request is cancelled 134 */ 135 public function testProcessWithProcessorCancellingRequest() 136 { 137 $postInterceptor1 = new MockstubPostInterceptor(); 138 $postInterceptor1->expectNever('postProcess'); 139 $postInterceptor2 = new MockstubPostInterceptor(); 140 $postInterceptor2->expectNever('postProcess'); 141 $this->mockInterceptorInitializer->setReturnValue('getPreInterceptors', array()); 142 $this->mockInterceptorInitializer->setReturnValue('getPostInterceptors', array($postInterceptor1, $postInterceptor2)); 143 $this->mockRequest->expectOnce('isCancelled'); 144 $this->mockRequest->setReturnValue('isCancelled', true); 145 $this->mockResponse2->expectOnce('send'); 146 $this->mockProcessorResolver->expectOnce('resolve'); 147 $this->frontController->process(); 148 } 149 150 /** 151 * assure that processing ends when request is cancelled 152 */ 153 public function testProcessWithPostInterceptorCancellingRequest() 154 { 155 $postInterceptor1 = new MockstubPostInterceptor(); 156 $postInterceptor1->expectOnce('postProcess'); 157 $postInterceptor2 = new MockstubPostInterceptor(); 158 $postInterceptor2->expectNever('postProcess'); 159 $this->mockInterceptorInitializer->setReturnValue('getPreInterceptors', array()); 160 $this->mockInterceptorInitializer->setReturnValue('getPostInterceptors', array($postInterceptor1, $postInterceptor2)); 161 $this->mockRequest->expectCallcount('isCancelled', 2); 162 $this->mockRequest->setReturnValueAt(0, 'isCancelled', false); 163 $this->mockRequest->setReturnValueAt(1, 'isCancelled', true); 164 $this->mockResponse2->expectOnce('send'); 165 $this->mockProcessorResolver->expectOnce('resolve'); 166 $this->frontController->process(); 167 } 168 169 /** 170 * assure that processing ends when request is cancelled 171 */ 172 public function testProcessWithoutCancellingRequest() 173 { 174 $preInterceptor1 = new MockstubPreInterceptor(); 175 $preInterceptor1->expectOnce('preProcess'); 176 $preInterceptor2 = new MockstubPreInterceptor(); 177 $preInterceptor2->expectOnce('preProcess'); 178 $this->mockInterceptorInitializer->setReturnValue('getPreInterceptors', array($preInterceptor1, $preInterceptor2)); 179 $postInterceptor1 = new MockstubPostInterceptor(); 180 $postInterceptor1->expectOnce('postProcess'); 181 $postInterceptor2 = new MockstubPostInterceptor(); 182 $postInterceptor2->expectOnce('postProcess'); 183 $this->mockInterceptorInitializer->setReturnValue('getPostInterceptors', array($postInterceptor1, $postInterceptor2)); 184 $this->mockRequest->setReturnValue('isCancelled', false); 185 $this->mockResponse2->expectOnce('send'); 186 $this->mockProcessorResolver->expectOnce('resolve'); 187 $this->mockWebsiteCacheFactory->expectOnce('configure'); 166 * 167 * @test 168 */ 169 public function processWithProcessorCancellingRequest() 170 { 171 $postInterceptor1 = $this->getMock('stubPostInterceptor'); 172 $postInterceptor1->expects($this->never())->method('postProcess'); 173 $postInterceptor2 = $this->getMock('stubPostInterceptor'); 174 $postInterceptor2->expects($this->never())->method('postProcess'); 175 $this->mockInterceptorInitializer->expects($this->once()) 176 ->method('getPreInterceptors') 177 ->will($this->returnValue(array())); 178 $this->mockInterceptorInitializer->expects($this->never()) 179 ->method('getPostInterceptors'); 180 $this->mockRequest->expects($this->once())->method('isCancelled')->will($this->returnValue(true)); 181 $this->mockProcessor->expects($this->any()) 182 ->method('process') 183 ->will($this->returnValue($this->mockProcessor)); 184 $this->mockResponse2 = $this->getMock('stubResponse'); 185 $this->mockResponse2->expects($this->once())->method('send'); 186 $this->mockProcessor->expects($this->once()) 187 ->method('getResponse') 188 ->will($this->returnValue($this->mockResponse2)); 189 $this->frontController->process(); 190 } 191 192 /** 193 * assure that processing ends when request is cancelled 194 * 195 * @test 196 */ 197 public function processWithPostInterceptorCancellingRequest() 198 { 199 $postInterceptor1 = $this->getMock('stubPostInterceptor'); 200 $postInterceptor1->expects($this->once())->method('postProcess'); 201 $postInterceptor2 = $this->getMock('stubPostInterceptor'); 202 $postInterceptor2->expects($this->never())->method('postProcess'); 203 $this->mockInterceptorInitializer->expects($this->once()) 204 ->method('getPreInterceptors') 205 ->will($this->returnValue(array())); 206 $this->mockInterceptorInitializer->expects($this->once()) 207 ->method('getPostInterceptors') 208 ->will($this->returnValue(array($postInterceptor1, $postInterceptor2))); 209 $this->mockRequest->expects($this->exactly(2)) 210 ->method('isCancelled') 211 ->will($this->onConsecutiveCalls(false, true)); 212 $this->mockProcessor->expects($this->any()) 213 ->method('process') 214 ->will($this->returnValue($this->mockProcessor)); 215 $this->mockResponse2 = $this->getMock('stubResponse'); 216 $this->mockResponse2->expects($this->once())->method('send'); 217 $this->mockProcessor->expects($this->once()) 218 ->method('getResponse') 219 ->will($this->returnValue($this->mockResponse2)); 220 $this->frontController->process(); 221 } 222 223 /** 224 * assure that processing ends when request is cancelled 225 * 226 * @test 227 */ 228 public function processWithoutCancellingRequest() 229 { 230 $preInterceptor1 = $this->getMock('stubPreInterceptor'); 231 $preInterceptor1->expects($this->once())->method('preProcess'); 232 $preInterceptor2 = $this->getMock('stubPreInterceptor'); 233 $preInterceptor2->expects($this->once())->method('preProcess'); 234 $this->mockInterceptorInitializer->expects($this->once()) 235 ->method('getPreInterceptors') 236 ->will($this->returnValue(array($preInterceptor1, $preInterceptor2))); 237 $postInterceptor1 = $this->getMock('stubPostInterceptor'); 238 $postInterceptor1->expects($this->once())->method('postProcess'); 239 $postInterceptor2 = $this->getMock('stubPostInterceptor'); 240 $postInterceptor2->expects($this->once())->method('postProcess'); 241 $this->mockInterceptorInitializer->expects($this->once()) 242 ->method('getPostInterceptors') 243 ->will($this->returnValue(array($postInterceptor1, $postInterceptor2))); 244 $this->mockRequest->expects($this->any())->method('isCancelled')->will($this->returnValue(false)); 245 $this->mockProcessor->expects($this->any()) 246 ->method('process') 247 ->will($this->returnValue($this->mockProcessor)); 248 $this->mockResponse2 = $this->getMock('stubResponse'); 249 $this->mockResponse2->expects($this->once())->method('send'); 250 $this->mockProcessor->expects($this->once()) 251 ->method('getResponse') 252 ->will($this->returnValue($this->mockResponse2)); 253 $this->mockWebsiteCacheFactory->expects($this->once())->method('configure'); 188 254 $this->frontController->setWebsiteCacheFactory($this->mockWebsiteCacheFactory); 189 255 $this->frontController->process(); trunk/src/test/php/net/stubbles/websites/stubPageTestCase.php
r1231 r1250 8 8 */ 9 9 stubClassLoader::load('net::stubbles::websites::stubPage'); 10 Mock::generate('stubPageElement');11 10 /** 12 11 * Tests for net::stubbles::websites::stubPage … … 15 14 * @subpackage websites_test 16 15 */ 17 class stubPageTestCase extends UnitTestCase16 class stubPageTestCase extends PHPUnit_Framework_TestCase 18 17 { 19 18 /** … … 23 22 */ 24 23 protected $stubPage; 25 24 26 25 /** 27 26 * set up test environment … … 31 30 $this->stubPage = new stubPage(); 32 31 } 33 32 34 33 /** 35 34 * assure that properties are set and retrieved correct 35 * 36 * @test 36 37 */ 37 public function testProperties()38 public function properties() 38 39 { 39 40 $this->assertFalse($this->stubPage->hasProperty('foo')); … … 41 42 $this->stubPage->setProperty('foo', 'bar'); 42 43 $this->assertTrue($this->stubPage->hasProperty('foo')); 43 $this->assertEqual ($this->stubPage->getProperty('foo'), 'bar');44 $this->assertEquals('bar', $this->stubPage->getProperty('foo')); 44 45 45 46 $this->stubPage->setProperties(array('baz' => 'baz', 'bar' => 'foo')); … … 47 48 $this->assertNull($this->stubPage->getProperty('foo')); 48 49 $this->assertTrue($this->stubPage->hasProperty('baz')); 49 $this->assertEqual ($this->stubPage->getProperty('baz'), 'baz');50 $this->assertEquals('baz', $this->stubPage->getProperty('baz')); 50 51 $this->assertTrue($this->stubPage->hasProperty('bar')); 51 $this->assertEqual ($this->stubPage->getProperty('bar'), 'foo');52 $this->assertEquals('foo', $this->stubPage->getProperty('bar')); 52 53 } 53 54 54 55 /** 55 56 * assure that page elements are set and retrieved correct 57 * 58 * @test 56 59 */ 57 public function testPageElements()60 public function pageElementsHandling() 58 61 { 59 $this->assertEqual($this->stubPage->getElements(), array()); 60 $mockPageElement1 = new MockstubPageElement(); 61 $mockPageElement1->setReturnValue('getName', 'foo'); 62 $this->assertEquals(array(), $this->stubPage->getElements()); 63 $mockPageElement1 = $this->getMock('stubPageElement'); 64 $mockPageElement1->expects($this->any()) 65 ->method('getName') 66 ->will($this->returnValue('foo')); 62 67 $this->stubPage->addElement($mockPageElement1); 63 $mockPageElement2 = new MockstubPageElement(); 64 $mockPageElement2->setReturnValue('getName', 'bar'); 68 $mockPageElement2 = $this->getMock('stubPageElement'); 69 $mockPageElement2->expects($this->any()) 70 ->method('getName') 71 ->will($this->returnValue('bar')); 65 72 $this->stubPage->addElement($mockPageElement2); 66 $this->assertEqual($this->stubPage->getElements(), array('foo' => $mockPageElement1, 67 'bar' => $mockPageElement2 68 ) 73 $this->assertEquals(array('foo' => $mockPageElement1, 74 'bar' => $mockPageElement2 75 ), 76 $this->stubPage->getElements() 69 77 ); 70 78 71 $mockPageElement3 = new MockstubPageElement(); 72 $mockPageElement3->setReturnValue('getName', 'foo'); 79 $mockPageElement3 = $this->getMock('stubPageElement'); 80 $mockPageElement3->expects($this->any()) 81 ->method('getName') 82 ->will($this->returnValue('foo')); 73 83 $this->stubPage->addElement($mockPageElement3); 74 $this->assertEqual($this->stubPage->getElements(), array('foo' => $mockPageElement3, 75 'bar' => $mockPageElement2 76 ) 84 $this->assertEquals(array('foo' => $mockPageElement3, 85 'bar' => $mockPageElement2 86 ), 87 $this->stubPage->getElements() 77 88 ); 78 89 } trunk/src/test/run.php
r1235 r1250 36 36 $testSuite->addTestFile(TEST_SRC_PATH . '/php/net/stubbles/service/ServiceTestSuite.php'); 37 37 $testSuite->addTestFile(TEST_SRC_PATH . '/php/net/stubbles/util/UtilTestSuite.php'); 38 $testSuite->addTestFile(TEST_SRC_PATH . '/php/net/stubbles/websites/WebsitesTestSuite.php');39 38 $testSuite->addTestFile(TEST_SRC_PATH . '/php/net/stubbles/websites/variantmanager/VariantManagerTestSuite.php'); 40 39 $testSuite->addTestFile(TEST_SRC_PATH . '/php/net/stubbles/xml/XMLTestSuite.php');
