Skip to content

Commit

Permalink
Use session interface from base package and renamed Laravel session c…
Browse files Browse the repository at this point in the history
…lass
  • Loading branch information
aimeos committed Feb 14, 2022
1 parent 59e2d0d commit 399c385
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
},
"autoload": {
"psr-4": {
"Aimeos\\Base\\": "lib/custom/src/Base",
"Aimeos\\MShop\\": "lib/custom/src/MShop",
"Aimeos\\MW\\": "lib/custom/src/MW"
},
"classmap": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/


namespace Aimeos\MW\Session;
namespace Aimeos\Base\Session;


/**
Expand All @@ -17,7 +17,7 @@
* @package MW
* @subpackage Session
*/
class Laravel5 extends Base implements \Aimeos\MW\Session\Iface
class Laravel extends Base implements \Aimeos\Base\Session\Iface
{
private $object;

Expand All @@ -37,7 +37,7 @@ public function __construct( \Illuminate\Session\Store $object )
* Sets a list of key/value pairs.
*
* @param array $values Associative list of key/value pairs
* @return \Aimeos\MW\Session\Iface Session instance for method chaining
* @return \Aimeos\Base\Session\Iface Session instance for method chaining
*/
public function apply( array $values ) : Iface
{
Expand All @@ -50,7 +50,7 @@ public function apply( array $values ) : Iface
* Remove the given key from the session.
*
* @param string $name Key of the requested value in the session
* @return \Aimeos\MW\Session\Iface Session instance for method chaining
* @return \Aimeos\Base\Session\Iface Session instance for method chaining
*/
public function del( string $name ) : Iface
{
Expand Down Expand Up @@ -94,7 +94,7 @@ public function pull( string $name, $default = null )
* Remove the list of keys from the session.
*
* @param array $name Keys to remove from the session
* @return \Aimeos\MW\Session\Iface Session instance for method chaining
* @return \Aimeos\Base\Session\Iface Session instance for method chaining
*/
public function remove( array $names ) : Iface
{
Expand All @@ -113,7 +113,7 @@ public function remove( array $names ) : Iface
*
* @param string $name Key to the value which should be stored in the session
* @param mixed $value Value that should be associated with the given key
* @return \Aimeos\MW\Session\Iface Session instance for method chaining
* @return \Aimeos\Base\Session\Iface Session instance for method chaining
*/
public function set( string $name, $value ) : Iface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
*/


namespace Aimeos\MW\Session;
namespace Aimeos\Base\Session;


class Laravel5Test extends \PHPUnit\Framework\TestCase
class LaravelTest extends \PHPUnit\Framework\TestCase
{
private $object;
private $mock;
Expand All @@ -25,7 +25,7 @@ protected function setUp() : void
->disableOriginalConstructor()
->getMock();

$this->object = new \Aimeos\MW\Session\Laravel5( $this->mock );
$this->object = new \Aimeos\Base\Session\Laravel( $this->mock );
}


Expand All @@ -40,7 +40,7 @@ public function testDel()
$this->mock->expects( $this->once() )->method( 'forget' )
->with( $this->equalTo( 'test' ) )->will( $this->returnSelf() );

$this->assertInstanceOf( \Aimeos\MW\Session\Iface::class, $this->object->del( 'test' ) );
$this->assertInstanceOf( \Aimeos\Base\Session\Iface::class, $this->object->del( 'test' ) );
}


Expand All @@ -67,7 +67,7 @@ public function testRemove()
$this->mock->expects( $this->once() )->method( 'forget' )
->with( $this->equalTo( 'test' ) )->will( $this->returnSelf() );

$this->assertInstanceOf( \Aimeos\MW\Session\Iface::class, $this->object->remove( ['test'] ) );
$this->assertInstanceOf( \Aimeos\Base\Session\Iface::class, $this->object->remove( ['test'] ) );
}


Expand All @@ -76,6 +76,6 @@ public function testSet()
$this->mock->expects( $this->once() )->method( 'put' )
->with( $this->equalTo( 'test' ), $this->equalTo( '123456789' ) );

$this->assertInstanceOf( \Aimeos\MW\Session\Iface::class, $this->object->set( 'test', '123456789' ) );
$this->assertInstanceOf( \Aimeos\Base\Session\Iface::class, $this->object->set( 'test', '123456789' ) );
}
}
2 changes: 1 addition & 1 deletion lib/custom/tests/TestHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ private static function createContext( $site )
$ctx->setI18n( array( 'de' => $i18n ) );


$session = new \Aimeos\MW\Session\None();
$session = new \Aimeos\Base\Session\None();
$ctx->setSession( $session );


Expand Down

0 comments on commit 399c385

Please sign in to comment.