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'); }
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'); }
/** * 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'); }
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'); }
/** * 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'); }
protected function setUp() { parent::setUp(); $this->object = new Category(); $this->object->addBehavior(new HierarchyBehavior()); $this->loadFixtures('Categories'); }
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'); }
protected function setUp() { parent::setUp(); $this->object = new Post(); $this->object->addBehavior(new SoftDeleteBehavior()); $this->loadFixtures('Posts'); }
/** * 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); }
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')); }
/** * 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)); } }
/** * 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()); }
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); }
/** * 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(); }
/** * 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' => []]); }
/** * 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(); }; }
/** * This method is called before a test is executed. */ protected function setUp() { parent::setUp(); $this->object = new ConfigAugment([], $this->defaults); }
/** * Setup bundles for specific conditions. */ protected function setUp() { parent::setUp(); $this->object = new LocaleBundle(['locale' => 'ex']); $this->object->addPath('common', TEMP_DIR . '/locales/{locale}/'); }
protected function setUp() { parent::setUp(); $this->object = new StorageStub(['expires' => '+3 days']); }
protected function tearDown() { //$this->logQueries(); parent::tearDown(); }
/** * Reset g11n. */ protected function tearDown() { parent::tearDown(); Registry::flush(); }
protected function setUp() { parent::setUp(); $this->object = new Schema('table'); }
protected function setUp() { parent::setUp(); $this->object = new SqlResultSet('SELECT * FROM `users` LIMIT 25'); }
protected function tearDown() { parent::tearDown(); $this->object->disconnect(); }
protected function setUp() { parent::setUp(); $this->object = new User(); $this->loadFixtures('Users'); }
protected function setUp() { parent::setUp(); $this->object = new ConverterBehavior(); $this->loadFixtures('Posts'); }
protected function setUp() { parent::setUp(); $this->object = new Database(); $this->object->addDriver('mysql', new DriverStub([])); }
protected function setUp() { parent::setUp(); $this->object = new ListFinder(); }
protected function setUp() { parent::setUp(); $this->object = new YearType(new DriverStub([])); }
protected function setUp() { parent::setUp(); $this->object = new SubQuery(SubQuery::SELECT, new User()); }