複数ネームスペースを可能に
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
namespace Site\Controller;
|
||||
|
||||
use Site\Controller\BlogPost;
|
||||
use Site\Lib\Markdown;
|
||||
use Std\Lib\Markdown;
|
||||
|
||||
class Atom extends BlogPost {
|
||||
private string $domain = 'technicalsuwako.moe';
|
||||
|
||||
@@ -3,7 +3,7 @@ namespace Site\Controller;
|
||||
|
||||
use Site\Controller\BlogPost;
|
||||
use Site\Controller\Mods;
|
||||
use Site\Lib\Activitypub;
|
||||
use Std\Lib\Activitypub;
|
||||
|
||||
class Fediverse extends BlogPost {
|
||||
use Mods;
|
||||
|
||||
@@ -3,10 +3,10 @@ namespace Site\Controller;
|
||||
|
||||
use Site\Controller\BlogPost;
|
||||
use Site\Controller\Mods;
|
||||
use Site\Lib\Activitypub;
|
||||
use Site\Lib\Auth;
|
||||
use Site\Lib\Markdown;
|
||||
use Site\Lib\Template;
|
||||
use Std\Lib\Activitypub;
|
||||
use Std\Lib\Auth;
|
||||
use Std\Lib\Markdown;
|
||||
use Std\Lib\Template;
|
||||
|
||||
class Home extends BlogPost {
|
||||
use Mods;
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
namespace Site\Controller;
|
||||
|
||||
use Site\Controller\Mods;
|
||||
use Site\Lib\Auth;
|
||||
use Site\Lib\Template;
|
||||
use Std\Lib\Auth;
|
||||
use Std\Lib\Template;
|
||||
|
||||
class Notfound {
|
||||
use Mods;
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
namespace Site\Controller;
|
||||
|
||||
use Site\Controller\Mods;
|
||||
use Site\Lib\Auth;
|
||||
use Site\Lib\Template;
|
||||
use Std\Lib\Auth;
|
||||
use Std\Lib\Template;
|
||||
|
||||
class Page {
|
||||
use Mods;
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
namespace Site\Controller;
|
||||
|
||||
use Site\Controller\Mods;
|
||||
use Site\Lib\Auth;
|
||||
use Site\Lib\Template;
|
||||
use Std\Lib\Auth;
|
||||
use Std\Lib\Template;
|
||||
|
||||
class User {
|
||||
use Mods;
|
||||
|
||||
19
src/Site/Test/ControllerUser.php
Normal file
19
src/Site/Test/ControllerUser.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Site\Test;
|
||||
|
||||
require_once __DIR__.'/../../../autoload.php';
|
||||
|
||||
use Site\Controller\User;
|
||||
use Std\Lib\Tester;
|
||||
|
||||
$test = new Tester([
|
||||
'colorOutput' => true,
|
||||
'verboseOutput' => true
|
||||
]);
|
||||
|
||||
$test->describe('', function($test): void {
|
||||
$test->it('', function($test): void {
|
||||
// TODO
|
||||
});
|
||||
});
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace Site\Lib;
|
||||
namespace Std\Lib;
|
||||
|
||||
use Site\Lib\Curl;
|
||||
use Std\Lib\Curl;
|
||||
|
||||
/**
|
||||
* ActivityPubプロトコルの実装クラス
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace Site\Lib;
|
||||
namespace Std\Lib;
|
||||
|
||||
class Auth {
|
||||
private int $id;
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace Site\Lib;
|
||||
namespace Std\Lib;
|
||||
|
||||
/**
|
||||
* php_curlへの依存を排除するための独自のCURL実装
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace Site\Lib;
|
||||
namespace Std\Lib;
|
||||
|
||||
class DiffViewer {
|
||||
private $diffContent;
|
||||
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
namespace Site\Lib;
|
||||
namespace Std\Lib;
|
||||
|
||||
use Site\Lib\Image\ImageInterface;
|
||||
use Site\Lib\Image\Gif;
|
||||
use Site\Lib\Image\Jpeg;
|
||||
use Site\Lib\Image\Png;
|
||||
use Site\Lib\Image\Targa;
|
||||
use Std\Lib\Image\ImageInterface;
|
||||
use Std\Lib\Image\Gif;
|
||||
use Std\Lib\Image\Jpeg;
|
||||
use Std\Lib\Image\Png;
|
||||
use Std\Lib\Image\Targa;
|
||||
|
||||
class RGB {
|
||||
public int $r;
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace Site\Lib\Image;
|
||||
namespace Std\Lib\Image;
|
||||
|
||||
use Site\Lib\Image\ImageInterface;
|
||||
use Std\Lib\Image\ImageInterface;
|
||||
|
||||
class Gif implements ImageInterface {
|
||||
public int $width = 0;
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace Site\Lib\Image;
|
||||
namespace Std\Lib\Image;
|
||||
|
||||
interface ImageInterface {
|
||||
public function parse(string $file): \stdClass;
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace Site\Lib\Image;
|
||||
namespace Std\Lib\Image;
|
||||
|
||||
use Site\Lib\Image\ImageInterface;
|
||||
use Std\Lib\Image\ImageInterface;
|
||||
|
||||
class Jpeg implements ImageInterface {
|
||||
public int $width = 0;
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace Site\Lib\Image;
|
||||
namespace Std\Lib\Image;
|
||||
|
||||
use Site\Lib\Image\ImageInterface;
|
||||
use Std\Lib\Image\ImageInterface;
|
||||
|
||||
class Png implements ImageInterface {
|
||||
public \stdClass $IHDR; // 画像ヘッダー
|
||||
@@ -151,7 +151,7 @@ next_chunk:
|
||||
if ($nextChunk === "\x50\x4c\x54\x45") { // PLTE
|
||||
$palette = [];
|
||||
for ($i = 0; $i < $length; $i += 3) {
|
||||
$colors = new \Site\Lib\RGB(ord($data[$i]), ord($data[$i+1]), ord($data[$i+2]));
|
||||
$colors = new \Std\Lib\RGB(ord($data[$i]), ord($data[$i+1]), ord($data[$i+2]));
|
||||
$palette[] = $colors->rgb;
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ next_chunk:
|
||||
$bytes = $this->IHDR->colorType === 2 ? 3 : 1;
|
||||
for ($i = 0; $i < $length; $i += $bytes) {
|
||||
if ($this->IHDR->colorType === 2) {
|
||||
$colors = new \Site\Lib\RGB(ord($data[$i]), ord($data[$i+1]), ord($data[$i+2]));
|
||||
$colors = new \Std\Lib\RGB(ord($data[$i]), ord($data[$i+1]), ord($data[$i+2]));
|
||||
$vals[] = $colors->rgb;
|
||||
} else {
|
||||
$vals[] = ord($data[$i]);
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace Site\Lib\Image;
|
||||
namespace Std\Lib\Image;
|
||||
|
||||
use Site\Lib\Image\ImageInterface;
|
||||
use Std\Lib\Image\ImageInterface;
|
||||
|
||||
class Targa implements ImageInterface {
|
||||
public int $id = 0;
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace Site\Lib;
|
||||
namespace Std\Lib;
|
||||
|
||||
class Mailer {
|
||||
private $socket;
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace Site\Lib;
|
||||
namespace Std\Lib;
|
||||
|
||||
class Markdown {
|
||||
private string $content;
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace Site\Lib;
|
||||
namespace Std\Lib;
|
||||
|
||||
class Route {
|
||||
protected static array $routes = [];
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace Site\Lib;
|
||||
namespace Std\Lib;
|
||||
|
||||
class Template {
|
||||
private string $tmplExt = '.maron';
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace Site\Lib;
|
||||
namespace Std\Lib;
|
||||
|
||||
/**
|
||||
* アサーション失敗用のカスタム例外
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
namespace Site\Test;
|
||||
namespace Std\Test;
|
||||
|
||||
require_once __DIR__.'/../../../autoload.php';
|
||||
|
||||
use Site\Lib\Tester;
|
||||
use Site\Lib\Activitypub;
|
||||
use Std\Lib\Tester;
|
||||
use Std\Lib\Activitypub;
|
||||
use Site\Controller\BlogPost;
|
||||
|
||||
if (ACTIVITYPUB_ENABLED) {
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
namespace Site\Test;
|
||||
namespace Std\Test;
|
||||
|
||||
require_once __DIR__.'/../../../autoload.php';
|
||||
|
||||
use Site\Lib\Tester;
|
||||
use Site\Lib\Auth;
|
||||
use Std\Lib\Tester;
|
||||
use Std\Lib\Auth;
|
||||
|
||||
if (AUTH_ENABLED) {
|
||||
$test = new Tester([
|
||||
@@ -156,7 +156,7 @@ if (AUTH_ENABLED) {
|
||||
});
|
||||
}
|
||||
|
||||
// TODO: CLIからクッキーを設定出来ないから、「Site\Lib\Auth::getUserData(): Return value must be of type stdClass, null returned」って発生する・・・
|
||||
// TODO: CLIからクッキーを設定出来ないから、「Lib\Auth::getUserData(): Return value must be of type stdClass, null returned」って発生する・・・
|
||||
// $test->describe('ログインとログアウト', function($test): void {
|
||||
// $user = "admin1234";
|
||||
// $pass = "testTEST1234!#$%@[]:;";
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
namespace Site\Test;
|
||||
namespace Std\Test;
|
||||
|
||||
require_once __DIR__.'/../../../autoload.php';
|
||||
|
||||
use Site\Lib\Tester;
|
||||
use Site\Lib\Curl;
|
||||
use Std\Lib\Tester;
|
||||
use Std\Lib\Curl;
|
||||
|
||||
if (CURL_ENABLED) {
|
||||
$test = new Tester([
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
namespace Site\Test;
|
||||
namespace Std\Test;
|
||||
|
||||
require_once __DIR__.'/../../../autoload.php';
|
||||
|
||||
use Site\Lib\Tester;
|
||||
use Site\Lib\Markdown;
|
||||
use Std\Lib\Tester;
|
||||
use Std\Lib\Markdown;
|
||||
|
||||
$test = new Tester([
|
||||
'colorOutput' => true,
|
||||
@@ -80,7 +80,7 @@ $test->describe('マークダウン', function($test): void {
|
||||
$body = $md->parse();
|
||||
$test->assertNotNull($body);
|
||||
|
||||
$expect = "<h1>ケロケロ</h1>";
|
||||
$expect = "<h1 id=\"section-1\">ケロケロ</h1>";
|
||||
$actual = trim($body);
|
||||
|
||||
$test->assertEquals($expect, $actual);
|
||||
@@ -95,7 +95,7 @@ $test->describe('マークダウン', function($test): void {
|
||||
$body = $md->parse();
|
||||
$test->assertNotNull($body);
|
||||
|
||||
$expect = "<h2>ケロケロ</h2>";
|
||||
$expect = "<h2 id=\"section-1\">ケロケロ</h2>";
|
||||
$actual = trim($body);
|
||||
|
||||
$test->assertEquals($expect, $actual);
|
||||
@@ -110,7 +110,7 @@ $test->describe('マークダウン', function($test): void {
|
||||
$body = $md->parse();
|
||||
$test->assertNotNull($body);
|
||||
|
||||
$expect = "<h3>ケロケロ</h3>";
|
||||
$expect = "<h3 id=\"section-1\">ケロケロ</h3>";
|
||||
$actual = trim($body);
|
||||
|
||||
$test->assertEquals($expect, $actual);
|
||||
@@ -125,7 +125,7 @@ $test->describe('マークダウン', function($test): void {
|
||||
$body = $md->parse();
|
||||
$test->assertNotNull($body);
|
||||
|
||||
$expect = "<h4>ケロケロ</h4>";
|
||||
$expect = "<h4 id=\"section-1\">ケロケロ</h4>";
|
||||
$actual = trim($body);
|
||||
|
||||
$test->assertEquals($expect, $actual);
|
||||
@@ -140,7 +140,7 @@ $test->describe('マークダウン', function($test): void {
|
||||
$body = $md->parse();
|
||||
$test->assertNotNull($body);
|
||||
|
||||
$expect = "<h5>ケロケロ</h5>";
|
||||
$expect = "<h5 id=\"section-1\">ケロケロ</h5>";
|
||||
$actual = trim($body);
|
||||
|
||||
$test->assertEquals($expect, $actual);
|
||||
@@ -155,7 +155,7 @@ $test->describe('マークダウン', function($test): void {
|
||||
$body = $md->parse();
|
||||
$test->assertNotNull($body);
|
||||
|
||||
$expect = "<h6>ケロケロ</h6>";
|
||||
$expect = "<h6 id=\"section-1\">ケロケロ</h6>";
|
||||
$actual = trim($body);
|
||||
|
||||
$test->assertEquals($expect, $actual);
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
namespace Site\Test;
|
||||
namespace Std\Test;
|
||||
|
||||
require_once __DIR__.'/../../../autoload.php';
|
||||
|
||||
use Site\Lib\Tester;
|
||||
use Site\Lib\Route;
|
||||
use Std\Lib\Tester;
|
||||
use Std\Lib\Route;
|
||||
|
||||
$test = new Tester([
|
||||
'colorOutput' => true,
|
||||
@@ -25,7 +25,7 @@ $test->describe('ルート', function($test): void {
|
||||
[
|
||||
'method' => 'GET',
|
||||
'path' => 'about',
|
||||
'class' => 'Site\Test\Webpage@about',
|
||||
'class' => 'Std\Test\Webpage@about',
|
||||
'params' => [],
|
||||
]
|
||||
];
|
||||
Reference in New Issue
Block a user