~ubuntu-branches/ubuntu/utopic/php-doctrine-common/utopic

« back to all changes in this revision

Viewing changes to tests/Doctrine/Tests/Common/Persistence/Mapping/StaticReflectionServiceTest.php

  • Committer: Package Import Robot
  • Author(s): David Prévot
  • Date: 2014-06-15 11:26:00 UTC
  • mfrom: (2.1.1 experimental)
  • Revision ID: package-import@ubuntu.com-20140615112600-sg4mgpwq9sfg4mre
Tags: 2.4.2-2
* Upload to unstable
* No tests if DEB_BUILD_OPTIONS contains nocheck

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/*
 
3
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
4
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
5
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 
6
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 
7
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 
8
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 
9
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 
10
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 
11
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 
12
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 
13
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
14
 *
 
15
 * This software consists of voluntary contributions made by many individuals
 
16
 * and is licensed under the MIT license. For more information, see
 
17
 * <http://www.doctrine-project.org>.
 
18
 */
 
19
 
 
20
namespace Doctrine\Tests\Common\Persistence\Mapping;
 
21
 
 
22
use Doctrine\Common\Persistence\Mapping\StaticReflectionService;
 
23
 
 
24
/**
 
25
 * @group DCOM-93
 
26
 */
 
27
class StaticReflectionServiceTest extends \PHPUnit_Framework_TestCase
 
28
{
 
29
    private $reflectionService;
 
30
 
 
31
    public function setUp()
 
32
    {
 
33
        $this->reflectionService = new StaticReflectionService();
 
34
    }
 
35
 
 
36
    public function testShortname()
 
37
    {
 
38
        $this->assertEquals("StaticReflectionServiceTest", $this->reflectionService->getClassShortName(__CLASS__));
 
39
    }
 
40
 
 
41
    public function testClassNamespaceName()
 
42
    {
 
43
        $this->assertEquals("Doctrine\Tests\Common\Persistence\Mapping", $this->reflectionService->getClassNamespace(__CLASS__));
 
44
    }
 
45
 
 
46
    public function testGetParentClasses()
 
47
    {
 
48
        $classes = $this->reflectionService->getParentClasses(__CLASS__);
 
49
        $this->assertTrue(count($classes) == 0, "The test class ".__CLASS__." should have no parents according to static reflection.");
 
50
    }
 
51
 
 
52
    public function testGetReflectionClass()
 
53
    {
 
54
        $class = $this->reflectionService->getClass(__CLASS__);
 
55
        $this->assertNull($class);
 
56
    }
 
57
 
 
58
    public function testGetMethods()
 
59
    {
 
60
        $this->assertTrue($this->reflectionService->hasPublicMethod(__CLASS__, "testGetMethods"));
 
61
        $this->assertTrue($this->reflectionService->hasPublicMethod(__CLASS__, "testGetMethods2"));
 
62
    }
 
63
 
 
64
    public function testGetAccessibleProperty()
 
65
    {
 
66
        $reflProp = $this->reflectionService->getAccessibleProperty(__CLASS__, "reflectionService");
 
67
        $this->assertNull($reflProp);
 
68
    }
 
69
}
 
70