コード例 #1
0
ファイル: OneToOneTest.php プロジェクト: titon/model
 protected function setUp()
 {
     parent::setUp();
     // User has one profile
     $this->object = new OneToOne('Profile', 'Titon\\Test\\Stub\\Model\\Profile');
     $this->object->setPrimaryClass('Titon\\Test\\Stub\\Model\\User');
 }
コード例 #2
0
ファイル: ManyToManyTest.php プロジェクト: titon/model
 protected function setUp()
 {
     parent::setUp();
     // Book belongs to many genre
     $this->object = new ManyToMany('Genre', 'Titon\\Test\\Stub\\Model\\Genre');
     $this->object->setPrimaryClass('Titon\\Test\\Stub\\Model\\Book');
 }
コード例 #3
0
ファイル: NumberTest.php プロジェクト: titon/g11n
 /**
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     parent::setUp();
     $this->object = Registry::factory('Titon\\G11n\\G11n');
     $this->object->addLocale(new Locale('en'));
     $this->object->useLocale('en');
 }
コード例 #4
0
ファイル: ManyToOneTest.php プロジェクト: titon/model
 protected function setUp()
 {
     parent::setUp();
     // User belongs to a country
     $this->object = new ManyToOne('Country', 'Titon\\Test\\Stub\\Model\\Country');
     $this->object->setPrimaryClass('Titon\\Test\\Stub\\Model\\User');
 }
コード例 #5
0
ファイル: ConverterTest.php プロジェクト: titon/utility-old
 /**
  * Setup resources.
  */
 protected function setUp()
 {
     parent::setUp();
     $data = array('key' => 'value', 'number' => 1337, 'boolean' => true, 'float' => 1.5, 'array' => array(1, 2, 3));
     $this->array = $data;
     // Object
     $object = new \stdClass();
     $object->key = 'value';
     $object->number = 1337;
     $object->boolean = true;
     $object->float = 1.5;
     $subObject = new \stdClass();
     $subObject->{'0'} = 1;
     $subObject->{'1'} = 2;
     $subObject->{'2'} = 3;
     $object->array = $subObject;
     $this->object = $object;
     // Json
     $this->json = json_encode($data);
     // Serialized
     $this->serialized = serialize($data);
     // XML
     $xml = '<?xml version="1.0" encoding="utf-8"?>' . "\n";
     $xml .= '<root>';
     $xml .= '<key>value</key>';
     $xml .= '<number>1337</number>';
     $xml .= '<boolean>true</boolean>';
     $xml .= '<float>1.5</float>';
     $xml .= '<array>1</array><array>2</array><array>3</array>';
     $xml .= '</root>';
     $this->xml = $xml;
     $this->barbarian = file_get_contents(TEMP_DIR . '/barbarian.xml');
 }
コード例 #6
0
ファイル: HierarchyBehaviorTest.php プロジェクト: titon/db
 protected function setUp()
 {
     parent::setUp();
     $this->object = new Category();
     $this->object->addBehavior(new HierarchyBehavior());
     $this->loadFixtures('Categories');
 }
コード例 #7
0
ファイル: OneToManyTest.php プロジェクト: titon/model
 protected function setUp()
 {
     parent::setUp();
     // User has many posts
     $this->object = new OneToMany('Post', 'Titon\\Test\\Stub\\Model\\Post');
     $this->object->setPrimaryClass('Titon\\Test\\Stub\\Model\\User');
 }
コード例 #8
0
ファイル: SoftDeleteBehaviorTest.php プロジェクト: titon/db
 protected function setUp()
 {
     parent::setUp();
     $this->object = new Post();
     $this->object->addBehavior(new SoftDeleteBehavior());
     $this->loadFixtures('Posts');
 }
コード例 #9
0
ファイル: ConfigTest.php プロジェクト: vpg/titon.common
 /**
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     parent::setUp();
     Config::set('app', $this->app);
     Config::set('debug', $this->debug);
     Config::set('test', $this->test);
 }
コード例 #10
0
 protected function setUp()
 {
     parent::setUp();
     // Assert true so we know cache is being written
     $this->assertEquals(true, $this->object->set('User::getById-1337', ['username' => 'Titon'], '+5 minutes'));
     $this->assertEquals(true, $this->object->set('Topic::getAll', [['id' => 1], ['id' => 2]], '-1 day'));
     // expired
     $this->assertEquals(true, $this->object->set('Comment::count', 1, '+5 minutes'));
 }
コード例 #11
0
ファイル: MessageTranslatorTest.php プロジェクト: titon/g11n
 /**
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     parent::setUp();
     $this->object = Registry::factory('Titon\\G11n\\G11n');
     $_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'ex-no,ex;q=0.5';
     foreach (['ex', 'en'] as $code) {
         $this->object->addLocale(new Locale($code));
     }
 }
コード例 #12
0
ファイル: G11nTest.php プロジェクト: titon/g11n
 /**
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     parent::setUp();
     $this->object = new G11n();
     foreach (['ex_VA', 'ex_IN', 'ex_FM', 'no'] as $code) {
         $this->object->addLocale(new Locale($code));
     }
     $this->object->setFallback('ex');
     $this->object->setTranslator(new MessageTranslator());
 }
コード例 #13
0
ファイル: CacheTest.php プロジェクト: vpg/titon.cache
 protected function setUp()
 {
     parent::setUp();
     $this->object = new Cache();
     $default = new MemoryStorage();
     $default->set('key', 'foo');
     $custom = new MemoryStorage();
     $custom->set('key', 'bar');
     $this->object->addStorage('default', $default);
     $this->object->addStorage('custom', $custom);
 }
コード例 #14
0
ファイル: LocaleTest.php プロジェクト: titon/g11n
 /**
  * Setup bundles for specific conditions.
  */
 protected function setUp()
 {
     parent::setUp();
     $this->parent = new Locale('ex');
     $this->parent->initialize();
     $this->formats = new Locale('ex_FM');
     $this->formats->initialize();
     $this->inflections = new Locale('ex_IN');
     $this->inflections->initialize();
     $this->validations = new Locale('ex_VA');
     $this->validations->initialize();
 }
コード例 #15
0
ファイル: FrontDispatcherTest.php プロジェクト: titon/mvc
 /**
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     parent::setUp();
     $module = new ModuleStub(TEMP_DIR);
     $module->setController('test-controller', 'Titon\\Test\\Stub\\ControllerStub');
     $app = new Application(new Request(), new Response());
     $app->addModule('test-module', $module);
     $this->object = new FrontDispatcher();
     $this->object->setApplication($app);
     $this->object->setRequest($app->getRequest());
     $this->object->setResponse($app->getResponse());
     $this->object->setParams(['module' => 'test-module', 'controller' => 'test-controller', 'action' => 'actionNoArgs', 'args' => []]);
 }
コード例 #16
0
ファイル: AttachableTest.php プロジェクト: vpg/titon.common
 /**
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     parent::setUp();
     $this->object = new TraitStub();
     // by closure
     $this->object->attachObject('base', function () {
         return new Base();
     });
     // by class
     $this->object->attachObject(['alias' => 'conf', 'class' => 'Titon\\Common\\Config']);
     // by property
     $this->object->registry = function () {
         return new Registry();
     };
 }
コード例 #17
0
 /**
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     parent::setUp();
     $this->object = new ConfigAugment([], $this->defaults);
 }
コード例 #18
0
ファイル: LocaleBundleTest.php プロジェクト: titon/g11n
 /**
  * Setup bundles for specific conditions.
  */
 protected function setUp()
 {
     parent::setUp();
     $this->object = new LocaleBundle(['locale' => 'ex']);
     $this->object->addPath('common', TEMP_DIR . '/locales/{locale}/');
 }
コード例 #19
0
ファイル: StorageTest.php プロジェクト: vpg/titon.cache
 protected function setUp()
 {
     parent::setUp();
     $this->object = new StorageStub(['expires' => '+3 days']);
 }
コード例 #20
0
ファイル: AbstractDbTest.php プロジェクト: titon/model
 protected function tearDown()
 {
     //$this->logQueries();
     parent::tearDown();
 }
コード例 #21
0
ファイル: LocaleRouteTest.php プロジェクト: titon/g11n
 /**
  * Reset g11n.
  */
 protected function tearDown()
 {
     parent::tearDown();
     Registry::flush();
 }
コード例 #22
0
ファイル: SchemaTest.php プロジェクト: titon/db
 protected function setUp()
 {
     parent::setUp();
     $this->object = new Schema('table');
 }
コード例 #23
0
ファイル: SqlResultSetTest.php プロジェクト: titon/db
 protected function setUp()
 {
     parent::setUp();
     $this->object = new SqlResultSet('SELECT * FROM `users` LIMIT 25');
 }
コード例 #24
0
ファイル: PdoDriverTest.php プロジェクト: titon/db
 protected function tearDown()
 {
     parent::tearDown();
     $this->object->disconnect();
 }
コード例 #25
0
ファイル: PdoResultSetTest.php プロジェクト: titon/db
 protected function setUp()
 {
     parent::setUp();
     $this->object = new User();
     $this->loadFixtures('Users');
 }
コード例 #26
0
ファイル: ConverterBehaviorTest.php プロジェクト: titon/db
 protected function setUp()
 {
     parent::setUp();
     $this->object = new ConverterBehavior();
     $this->loadFixtures('Posts');
 }
コード例 #27
0
ファイル: DatabaseTest.php プロジェクト: titon/db
 protected function setUp()
 {
     parent::setUp();
     $this->object = new Database();
     $this->object->addDriver('mysql', new DriverStub([]));
 }
コード例 #28
0
ファイル: ListFinderTest.php プロジェクト: titon/db
 protected function setUp()
 {
     parent::setUp();
     $this->object = new ListFinder();
 }
コード例 #29
0
ファイル: YearTypeTest.php プロジェクト: titon/db
 protected function setUp()
 {
     parent::setUp();
     $this->object = new YearType(new DriverStub([]));
 }
コード例 #30
0
ファイル: SubQueryTest.php プロジェクト: titon/db
 protected function setUp()
 {
     parent::setUp();
     $this->object = new SubQuery(SubQuery::SELECT, new User());
 }