| <?php | |
| /******************************************************************************* | |
| * Copyright (c) 2010 Eclipse Foundation and others. | |
| * All rights reserved. This program and the accompanying materials | |
| * are made available under the terms of the Eclipse Public License v1.0 | |
| * which accompanies this distribution, and is available at | |
| * http://www.eclipse.org/legal/epl-v10.html | |
| * | |
| * Contributors: | |
| * Wayne Beaton (Eclipse Foundation)- initial API and implementation | |
| *******************************************************************************/ | |
| require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/app.class.php"); | |
| $App = new App(); | |
| require_once '../classes/Activity.class.php'; | |
| require_once '../classes/TestRunner.class.php'; | |
| class ActivityTests extends TestCase { | |
| function testFindPreviousThursday() { | |
| $this->assertEquals('2011-05-26', findPreviousThursday('2011-05-31')); | |
| $this->assertEquals('2011-05-26', findPreviousThursday('2011-06-01')); | |
| $this->assertEquals('2011-06-02', findPreviousThursday('2011-06-02')); | |
| $this->assertEquals('2011-06-02', findPreviousThursday('2011-06-03')); | |
| $this->assertEquals('2011-06-02', findPreviousThursday('2011-06-04')); | |
| $this->assertEquals('2011-06-02', findPreviousThursday('2011-06-05')); | |
| $this->assertEquals('2011-06-02', findPreviousThursday('2011-06-06')); | |
| $this->assertEquals('2011-06-02', findPreviousThursday('2011-06-07')); | |
| $this->assertEquals('2011-06-02', findPreviousThursday('2011-06-08')); | |
| $this->assertEquals('2011-06-09', findPreviousThursday('2011-06-09')); | |
| $this->assertEquals('2011-06-09', findPreviousThursday('2011-06-10')); | |
| $this->assertEquals('2011-06-09', findPreviousThursday('2011-06-11')); | |
| } | |
| function testFindNextWednesday() { | |
| $this->assertEquals('2011-05-25', findNextWednesday('2011-05-23')); | |
| $this->assertEquals('2011-05-25', findNextWednesday('2011-05-24')); | |
| $this->assertEquals('2011-05-25', findNextWednesday('2011-05-25')); | |
| $this->assertEquals('2011-06-01', findNextWednesday('2011-05-26')); | |
| $this->assertEquals('2011-06-01', findNextWednesday('2011-05-27')); | |
| $this->assertEquals('2011-06-01', findNextWednesday('2011-05-28')); | |
| $this->assertEquals('2011-06-01', findNextWednesday('2011-05-29')); | |
| $this->assertEquals('2011-06-01', findNextWednesday('2011-05-30')); | |
| $this->assertEquals('2011-06-01', findNextWednesday('2011-05-31')); | |
| $this->assertEquals('2011-06-01', findNextWednesday('2011-06-01')); | |
| $this->assertEquals('2011-06-08', findNextWednesday('2011-06-02')); | |
| $this->assertEquals('2011-06-08', findNextWednesday('2011-06-03')); | |
| $this->assertEquals('2011-06-08', findNextWednesday('2011-06-04')); | |
| $this->assertEquals('2011-06-08', findNextWednesday('2011-06-05')); | |
| $this->assertEquals('2011-06-08', findNextWednesday('2011-06-06')); | |
| $this->assertEquals('2011-06-08', findNextWednesday('2011-06-07')); | |
| $this->assertEquals('2011-06-08', findNextWednesday('2011-06-08')); | |
| $this->assertEquals('2011-06-15', findNextWednesday('2011-06-09')); | |
| } | |
| } | |
| $App = new App(); | |
| $runner = new TestRunner("ActivityTests"); | |
| $runner->run_tests(); | |
| ?> |