Railsbin – The vulnerable pastebin service!

User:

Title: LUP

Content:

<?php
namespace GDO\LinkUUp\Test;

use GDO\Tests\TestCase;
use GDO\LinkUUp\LUP_Room;
use GDO\LinkUUp\LUP_Category;
use GDO\LinkUUp\Module_LinkUUp;
use GDO\File\GDO_File;
use function PHPUnit\Framework\assertTrue;
use GDO\Address\GDO_Address;

/**
 * LinkUUp automated code quality test cases.
 * 
 * @author gizmore
 * @since 7.0.1
 */
final class LUPTest extends TestCase
{
	private LUP_Category $germany;
	private GDO_File $germanyIcon;
	private GDO_Address $germanyAddress;
	
	public function testCategoryIcon()
	{
		$module = Module_LinkUUp::instance();
		$path = $module->filePath('data/germany.png');
		$image = GDO_File::fromPath('germany.png', $path)->insert()->copy();
		$this->germanyIcon = $image;
		assertTrue($image->isPersisted(), 'Test if a category icon can be created.');
	}
	
	public function testCategoryCreation()
	{
		$cat = LUP_Category::blank([
			'cat_name' => 'Special',
			'cat_color' => '#FF0000', # Knallrot
			'cat_icon' => $this->germanyIcon->getID(),
		])->insert();
		$this->germany = $cat;
		assert($cat->isPersisted(), 'Test if a category can be created.');
	}
	
	public function testAddressCreation()
	{
		$add = GDO_Address::blank([
			'address_company' => 'Deutschland GmbH',
			'address_vat' => '0000001',
			'address_name' => 'Angela Merkel',
			'address_street' => 'Am Brandenburger Tor 1',
			'address_zip' => '10000',
			'address_city' => 'Berlin',
			'address_country' => 'DE',
			'address_phone' => null,
			'address_phone_fax' => null,
			'address_phone_mobile' => null,
			'address_email' => 'support@linkuup.de',
		])->insert();
		assert($add->isPersisted(), "Test if address can be created.");
		$this->germanyAddress = $add;
	}
	
	public function testGermanyRoomCreation()
	{
		$germany = LUP_Room::blank([
			'room_owner' => '2', # gizmore
			'room_name' => 'Germany',
			'room_info' => 'Der Deutschland Kanal nur für Euch!',
			'room_color' => '#FFD700', # Gold
			'room_category' => $this->germany->getID(),
			'room_pos_lat' => '20.0',
			'room_pos_lng' => '20.0',
			'room_view' => '42000.0',
			'room_radius' => '800.0',
			'room_www' => 'https://de.wikipedia.org/wiki/Deutschland',
			'room_phone' => '+49 176 - 59 59 88 44',
			'room_hours' => null,
			'room_address' => $this->germanyAddress->getID(),
			'room_image' => $this->germanyIcon->getID(),
			'room_show_distance' => '0',
		])->insert();
		assert($germany->isPersisted(), 'Test if germany can be created.');
		$this->germany = $germany; # for the next test.
	}
	
	
}

Edit | Back