Vendor update && Started using DoctrineMigrations

This commit is contained in:
Polonkai Gergely
2012-07-23 17:09:03 +02:00
parent 7c36f93436
commit bf46316347
1102 changed files with 103189 additions and 7 deletions

View File

@@ -0,0 +1,35 @@
<?php
/*
* Copyright 2011 Johannes M. Schmitt <schmittjoh@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace JMS\DiExtraBundle\Tests\Metadata;
use JMS\DiExtraBundle\Metadata\ClassMetadata;
class ClassMetadataTest extends \PHPUnit_Framework_TestCase
{
public function testSerializeUnserialize()
{
$classMetadata = new ClassMetadata('JMS\DiExtraBundle\Tests\Fixture\LoginController');
$classMetadata->arguments = array('foo', 'bar');
$classMetadata->abstract = true;
$classMetadata->public = false;
$classMetadata->id = 'foo';
$this->assertEquals($classMetadata, unserialize(serialize($classMetadata)));
}
}

View File

@@ -0,0 +1,37 @@
<?php
namespace JMS\DiExtraBundle\Tests\Metadata\Driver;
use Doctrine\Common\Annotations\AnnotationReader;
use JMS\DiExtraBundle\Metadata\Driver\AnnotationDriver;
class AnnotationDriverTest extends \PHPUnit_Framework_TestCase
{
public function testFormType()
{
$metadata = $this->getDriver()->loadMetadataForClass(new \ReflectionClass('JMS\DiExtraBundle\Tests\Metadata\Driver\Fixture\LoginType'));
$this->assertEquals('j_m_s.di_extra_bundle.tests.metadata.driver.fixture.login_type', $metadata->id);
$this->assertEquals(array(
'form.type' => array(
array('alias' => 'login'),
)
), $metadata->tags);
}
public function testFormTypeWithExplicitAlias()
{
$metadata = $this->getDriver()->loadMetadataForClass(new \ReflectionClass('JMS\DiExtraBundle\Tests\Metadata\Driver\Fixture\SignUpType'));
$this->assertEquals(array(
'form.type' => array(
array('alias' => 'foo'),
)
), $metadata->tags);
}
private function getDriver()
{
return new AnnotationDriver(new AnnotationReader());
}
}

View File

@@ -0,0 +1,27 @@
<?php
namespace JMS\DiExtraBundle\Tests\Metadata\Driver\Fixture;
use Security\SecurityContext;
use Symfony\Component\Form\AbstractType;
use JMS\DiExtraBundle as DI; // Use this alias in order to not have this class picked up by the finder
/**
* @DI\Annotation\FormType
*
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
*/
class LoginType extends AbstractType
{
private $securityContext;
public function __construct(SecurityContext $context)
{
$this->securityContext = $context;
}
public function getName()
{
return 'login';
}
}

View File

@@ -0,0 +1,19 @@
<?php
namespace JMS\DiExtraBundle\Tests\Metadata\Driver\Fixture;
use Symfony\Component\Form\AbstractType;
use JMS\DiExtraBundle as DI;
/**
* @DI\Annotation\FormType("foo")
*
* @author johannes
*/
class SignUpType extends AbstractType
{
public function getName()
{
return 'sign_up';
}
}