root/trunk/generator/test/classes/bookstore/BookstoreTestBase.php

Revision 1024, 3.8 kB (checked in by hans, 4 months ago)

Updating license to version 3 of the LGPL.

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id Rev Date Author HeadURL Revision
Line 
1 <?php
2 /*
3  *  $Id$
4  *
5  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
6  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
7  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
8  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
9  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
10  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
11  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
12  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
13  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
14  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
15  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
16  *
17  * This software consists of voluntary contributions made by many individuals
18  * and is licensed under version 3 of the LGPL. For more information please see
19  * <http://propel.phpdb.org>.
20  */
21
22 require_once 'PHPUnit/Framework/TestCase.php';
23 include_once 'bookstore/BookstoreDataPopulator.php';
24
25 /**
26  * Base class contains some methods shared by subclass test cases.
27  */
28 abstract class BookstoreTestBase extends PHPUnit_Framework_TestCase {
29
30     /**
31      * This is run before each unit test; it populates the database.
32      */
33     protected function setUp()
34     {
35         parent::setUp();
36         BookstoreDataPopulator::depopulate();
37         BookstoreDataPopulator::populate();
38     }
39
40     /**
41      * This is run after each unit test.  It empties the database.
42      */
43     protected function tearDown()
44     {
45
46         BookstoreDataPopulator::depopulate();
47
48         $this->assertEquals(0, count(BookPeer::doSelect(new Criteria())), "Expect book table to be empty.");
49         $this->assertEquals(0, count(AuthorPeer::doSelect(new Criteria())), "Expect author table to be empty.");
50         $this->assertEquals(0, count(PublisherPeer::doSelect(new Criteria())), "Expect publisher table to be empty.");
51         $this->assertEquals(0, count(ReviewPeer::doSelect(new Criteria())), "Expect review table to be empty.");
52         $this->assertEquals(0, count(MediaPeer::doSelect(new Criteria())), "Expect media table to be empty.");
53         $this->assertEquals(0, count(BookstoreEmployeePeer::doSelect(new Criteria())), "Expect bookstore_employee table to be empty.");
54         $this->assertEquals(0, count(BookstoreEmployeeAccountPeer::doSelect(new Criteria())), "Expect bookstore_employee_account table to be empty.");
55         $this->assertEquals(0, count(BookstoreSalePeer::doSelect(new Criteria())), "Expect bookstore_sale table to be empty.");
56
57         BookPeer::clearInstancePool();
58         $this->assertEquals(0, count(BookPeer::$instances), "Expected 0 Book instances after clearInstancePool()");
59
60         AuthorPeer::clearInstancePool();
61         $this->assertEquals(0, count(AuthorPeer::$instances), "Expected 0 Author instances after clearInstancePool()");
62
63         PublisherPeer::clearInstancePool();
64         $this->assertEquals(0, count(PublisherPeer::$instances), "Expected 0 Publisher instances after clearInstancePool()");
65
66         ReviewPeer::clearInstancePool();
67         $this->assertEquals(0, count(ReviewPeer::$instances), "Expected 0 Review instances after clearInstancePool()");
68
69         MediaPeer::clearInstancePool();
70         $this->assertEquals(0, count(MediaPeer::$instances), "Expected 0 Media instances after clearInstancePool()");
71
72         BookstoreEmployeePeer::clearInstancePool();
73         $this->assertEquals(0, count(BookstoreEmployeePeer::$instances), "Expected 0 BookstoreEmployee instances after clearInstancePool()");
74
75         BookstoreEmployeeAccountPeer::clearInstancePool();
76         $this->assertEquals(0, count(BookstoreEmployeeAccountPeer::$instances), "Expected 0 BookstoreEmployeeAccount instances after clearInstancePool()");
77
78         BookstoreSalePeer::clearInstancePool();
79         $this->assertEquals(0, count(BookstoreSalePeer::$instances), "Expected 0 BookstoreSale instances after clearInstancePool()");
80
81         parent::tearDown();
82     }
83
84 }
85
Note: See TracBrowser for help on using the browser.